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 01:46:30 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

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

> Now, concerning the use of lists vs. strings, you
> answered the question of why the special syntax
> yourself. to make it more readable.

With lists and strings this makes sense but with
vectors it is only more readable in the face of all
the surrounding Lisp, which otherwise would look the
same, because in isolation a parenthesised vector is
just as readable as one in square brackets. But they
aren't used in isolation but indeed amid Lisp so yes,
the special syntax makes it more readable by just
a bit. Again, especially if combined with a special vector
highlight.

Why the syntax is there at all is to provide fast
(faster) access to the vector data type which has
other time and space properties than do lists.
Because in the "platonic" sense, as Random put it,
there aren't any differences between lists and
vectors, at least not between lists which carry data
of a uniform type (e.g., a bunch of integers), so this
difference is on the implementation side where vectors
are allocated in cohesive memory which, because the
uniform type and total length are known, it makes for
constant access time.

> Now, nothing prevents you to travel back to 1960 ...

Save for physics, I'd go in a heartbeat... Only I'd
put a blind eye to the politics, hallucinogens and
computer infancy are sure appealing enough.

> Notice by the way that in emacs lisp, we lack
> structure types. We can still implement them using
> vectors (or lists), and write program using the
> structure abstraction. If you want to write programs
> using vector or string abstractions without using
> actual vector or string type objects you can do so.

Yeah, all the math stuff would be just as easy to do
with lists. It is the computer stuff with memory
access O(whatever) that is the difference.

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




reply via email to

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