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: Barry Margolin
Subject: Re: why are there [v e c t o r s] in Lisp?
Date: Sat, 17 Oct 2015 01:53:04 -0400
User-agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)

In article <mailman.491.1445056308.7904.help-gnu-emacs@gnu.org>,
 Emanuel Berg <embe8573@student.uu.se> wrote:

> "Pascal J. Bourguignon" <pjb@informatimago.com>
> writes:
> 
> >> 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.
> >
> > ABSOLUTELY NOT.
> >
> > For example, in C++ you have vectors and lists, but
> > you don't have any literal syntax for them.
> >
> > You can have fast and slow data structures without
> > having any literal syntax for it.
> >
> > Why do you keep confusing the two concepts?
> 
> The original question was why there is a special
> syntax for vectors, even as lists are perfectly fitted
> to be vectors.
> 
> The question was not why there are lists AND vectors.
> But that issue is also interesting so that discussion
> wasn't wasted on anyone who read it (perhaps).
> 
> As for the syntax, the "literal"
> 
>     [1 2 3]
> 
> is a faster and more readable way than
> 
>     (vector 1 2 3)
> 
> to tell the computer when it should use what, because
> the computer isn't advanced enough to figure this out
> on it own.

Which is similar to the reason why we have literal lists:

    '(1 2 3)

when you could just use

    (list 1 2 3)

Literals are just a convenience feature. When arrays were added to 
MacLisp, they didn't have a literal syntax. Common Lisp added the syntax 
#(1 2 3) for them (and a more general syntax for multi-dimensional 
arrays). Common Lisp also added a syntax for structure literals.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


reply via email to

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