[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Basic questions about elisp
From: |
Francis Moreau |
Subject: |
Re: Basic questions about elisp |
Date: |
Mon, 09 Nov 2009 21:51:18 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) |
tomas@tuxteam.de writes:
> On Sat, Nov 07, 2009 at 06:49:52AM -0800, Francis Moreau wrote:
>> On 6 nov, 22:18, p...@informatimago.com (Pascal J. Bourguignon) wrote:
>> > Francis Moreau <francis.m...@gmail.com> writes:
>
> [...]
>
>> > > Actually the same stands for the implementation of the list, where
>> > > nconc, length... are O(n). I wouldn't have thought that lists are really
>> > > implemented by the car & cdr thing only.
>> >
>> > Why not? If people have been repeating for 50 years that lisp lists
>> > are implemented with cons, car and cdr...
>>
>> Because I can understand there were some memory constraints 50 years
>> ago that force lisp lists to be as small as possible. But I would have
>> thought lisp lists (or (e)lisp) to evolve as computer memories did.
>
> There's no "one data structure fits all" philosophy here. Use list for
> "list things" and arrays for "array things". Nowadays all Lisps have
> some form or other of array.
>
> And still, lists are among the strongest points of Lisp. They are
> simple and flexible, they are the representation of Lisp programs. They
> are the reason why Lisp programmers are writing programs that write
> programs ever since ~50 years ago.
>
> If a list doesn't fit your bill, by all means: use defstruct, use
> arrays, use hashes. But (as Pascal pointed out), sometimes lists fit a
> bill quite unexpectedly, if you are willing to think flexibly (e.g. push
> new elements at the head instead of append, etc).
yeah, optimized push/pop operations of lists is a bit unusual for me,
it's actually like using stack instead of lists. Specially since the
first code I tried to write with elisp was a sort algo where order
matters and first parsed elements need to be the first ones in the list.
Thanks
--
Francis
- Re: Basic questions about elisp, (continued)
Re: Basic questions about elisp, Pascal J. Bourguignon, 2009/11/05
- Re: Basic questions about elisp, David Kastrup, 2009/11/05
- Re: Basic questions about elisp, Francis Moreau, 2009/11/06
- Re: Basic questions about elisp, David Kastrup, 2009/11/06
- Re: Basic questions about elisp, Francis Moreau, 2009/11/06
- Re: Basic questions about elisp, Pascal J. Bourguignon, 2009/11/06
- Re: Basic questions about elisp, Francis Moreau, 2009/11/07
- Re: Basic questions about elisp, Pascal J. Bourguignon, 2009/11/07
- Re: Basic questions about elisp, tomas, 2009/11/08
- Message not available
- Re: Basic questions about elisp,
Francis Moreau <=
Re: Basic questions about elisp, Francis Moreau, 2009/11/08
Re: Basic questions about elisp, tomas, 2009/11/08
Re: Basic questions about elisp, Pascal J. Bourguignon, 2009/11/08
Re: Basic questions about elisp, Francis Moreau, 2009/11/09
Re: Basic questions about elisp, Joost Kremers, 2009/11/10
Re: Basic questions about elisp, Francis Moreau, 2009/11/10
Re: Basic questions about elisp, David Kastrup, 2009/11/10
Re: Basic questions about elisp, Barry Margolin, 2009/11/06