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: Pascal J. Bourguignon
Subject: Re: why are there [v e c t o r s] in Lisp?
Date: Sat, 17 Oct 2015 17:25:35 +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:
>
>> In emacs lisp it'd be difficult to do it, but in
>> Common Lisp it's trivial
>
> I didn't say I wanted strings not to be
>
>     "strings"
>
> but
>
>     '(32 9 13 105 10 103)
>
> But having the vector
>
>     [1 2 3]
>
> as
>
>     '(1 2 3)
>
> wouldn't be bad if the computer could figure out on
> its own the most efficient way to store and interact
> with the data.

As I said, you could write a compiler performing global analysis to
determine how you use a given object in the data flow, and therefore
store the literal as a list or as a vector.

One complication would be I/O. The data flow analysis could let the
compiler determine that some object read shall be stored as a vector or
as list, but the reading function wouldn't know that from the external
syntax, and it would need an additionnal type parameter.

Notice that this introduces some kind of static typing which is rather
contrary to the lisp spirit and makes thing so bad in serializing
non-lisp like languages.


At this point, the best you could do is to start writing your own
compiler to implement this idea, and see whether it's a good idea or
not.

-- 
__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


reply via email to

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