help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: why are there [v e c t o r s] in Lisp?


From: Emanuel Berg
Subject: Re: why are there [v e c t o r s] in Lisp?
Date: Sat, 17 Oct 2015 23:06:32 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

"Pascal J. Bourguignon" <pjb@informatimago.com>
writes:

> You are asking why apples are of a certain color,
> even as peaches have a kernel.

OK - why is that?

> I don't know what you mean by "this" in "figure this
> out on its own".

As I know you know, there are languages (e.g., SML)
that do have types but still it isn't compulsory to
spell them out in the code. The types are instead
inferred, "leaving the programmer free to omit type
annotations while still permitting type checking." [1]

> The speed is irrelevant here, there are semantic
> differences:
>
> (setf print-circle t) (loop repeat 3 collect [1 2 3])
> --> (#1=[1 2 3] #1# #1#) (loop repeat 3 collect
> (vector 1 2 3)) --> ([1 2 3] [1 2 3] [1 2 3])

It is since several posts clear that lists and vectors
are two different general-purpose data structures,
with different properties with respect to access times
and memory allocation policy, and also with different
methods to interact with the data - because they are
different types.

In particular, the vector is a 1-dimensional array,
and not an implementation/tool to specifically do
linear algebra or any other math or science discipline
that uses vectors as the modeling building blocks.
This is not to say that cannot happen, just as it can
happen with lists being the base data structure.

[1] https://en.wikipedia.org/wiki/Type_inference

-- 
underground experts united
http://user.it.uu.se/~embe8573




reply via email to

[Prev in Thread] Current Thread [Next in Thread]