[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: |
Pascal J. Bourguignon |
Subject: |
Re: why are there [v e c t o r s] in Lisp? |
Date: |
Sat, 17 Oct 2015 17:16:24 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Emanuel Berg <embe8573@student.uu.se> writes:
> "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.
You did it again. You are asking why apples are of a certain color,
even as peaches have a kernel.
The two things are totally unrelated.
> The question was not why there are lists AND vectors.
If the question excludes this, then then original question is "why there
is a special syntax for vectors?". And I gave you the answer: because
otherwise you would have to build vectors are run-time using a more
complex expression and a more complex algorithm. Also, the compiler
couldn't perform the optimization it is allowed to perform on literal
objects, namely coalescing of equal literals, and storing them in ROM.
> 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.
I don't know what you mean by "this" in "figure this out on its own".
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])
--
__Pascal Bourguignon__ http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk
- Re: why are there [v e c t o r s] in Lisp?, (continued)
- Message not available
- Re: why are there [v e c t o r s] in Lisp?, Pascal J. Bourguignon, 2015/10/15
- Re: why are there [v e c t o r s] in Lisp?, Emanuel Berg, 2015/10/16
- Message not available
- Re: why are there [v e c t o r s] in Lisp?, Pascal J. Bourguignon, 2015/10/16
- Re: why are there [v e c t o r s] in Lisp?, Emanuel Berg, 2015/10/17
- Re: why are there [v e c t o r s] in Lisp?, Random832, 2015/10/17
- Re: why are there [v e c t o r s] in Lisp?, Emanuel Berg, 2015/10/17
- Message not available
- Re: why are there [v e c t o r s] in Lisp?, Barry Margolin, 2015/10/17
- Re: why are there [v e c t o r s] in Lisp?, Barry Margolin, 2015/10/17
- Re: why are there [v e c t o r s] in Lisp?, Emanuel Berg, 2015/10/17
- Message not available
- Re: why are there [v e c t o r s] in Lisp?,
Pascal J. Bourguignon <=
- Re: why are there [v e c t o r s] in Lisp?, Emanuel Berg, 2015/10/17
- Message not available
- Re: why are there [v e c t o r s] in Lisp?, Pascal J. Bourguignon, 2015/10/17
- Re: why are there [v e c t o r s] in Lisp?, Emanuel Berg, 2015/10/18
- Message not available
- Re: why are there [v e c t o r s] in Lisp?, Pascal J. Bourguignon, 2015/10/18
- Re: why are there [v e c t o r s] in Lisp?, Emanuel Berg, 2015/10/18
- Re: why are there [v e c t o r s] in Lisp?, Robert Thorpe, 2015/10/18
- Message not available
- Re: why are there [v e c t o r s] in Lisp?, Barry Margolin, 2015/10/18
- Re: why are there [v e c t o r s] in Lisp?, Emanuel Berg, 2015/10/18
- Re: why are there [v e c t o r s] in Lisp?, Random832, 2015/10/18
- Message not available
- Re: why are there [v e c t o r s] in Lisp?, Pascal J. Bourguignon, 2015/10/18