From: tomas@tuxteam.de
To: Francis Moreau <francis.moro@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Basic questions about elisp
Date: Sun, 8 Nov 2009 10:46:18 +0100 [thread overview]
Message-ID: <20091108094618.GA17095@tomas> (raw)
In-Reply-To: <8229723a-5415-4a8e-b306-8e694f9cccb7@a32g2000yqm.googlegroups.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
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).
Ah, btw. Some Lisp implementations optimize runs of lists as arrays
behind the scenes (search for "cdr compression"). But you still get this
nice, simple and expressive programming interface.
Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFK9pNqBcgs9XrR2kYRArYpAJ9/CnR5m6JBknoM3FcDVMrlqyDBygCfeKVh
2QyoTVHjkwWxtb/Uu8Abj1o=
=Zmom
-----END PGP SIGNATURE-----
next prev parent reply other threads:[~2009-11-08 9:46 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-05 11:13 Basic questions about elisp Francis Moreau
2009-11-05 11:50 ` Lennart Borgman
[not found] ` <mailman.10118.1257421858.2239.help-gnu-emacs@gnu.org>
2009-11-05 12:07 ` Francis Moreau
2009-11-05 12:44 ` Lennart Borgman
2009-11-05 12:59 ` David Kastrup
2009-11-05 14:25 ` Francis Moreau
2009-11-05 14:37 ` Pascal J. Bourguignon
2009-11-05 14:58 ` Pascal J. Bourguignon
2009-11-05 12:57 ` tomas
[not found] ` <mailman.10122.1257425638.2239.help-gnu-emacs@gnu.org>
2009-11-05 14:29 ` Francis Moreau
2009-11-05 14:41 ` Pascal J. Bourguignon
2009-11-05 15:06 ` David Kastrup
2009-11-06 16:03 ` Francis Moreau
2009-11-06 16:49 ` David Kastrup
2009-11-06 20:53 ` Francis Moreau
2009-11-06 21:18 ` Pascal J. Bourguignon
2009-11-07 14:49 ` Francis Moreau
2009-11-07 17:50 ` Pascal J. Bourguignon
2009-11-08 9:46 ` tomas [this message]
[not found] ` <mailman.10266.1257674088.2239.help-gnu-emacs@gnu.org>
2009-11-09 20:51 ` Francis Moreau
2009-11-08 15:18 ` Francis Moreau
2009-11-08 16:58 ` tomas
2009-11-08 17:12 ` Pascal J. Bourguignon
2009-11-09 21:04 ` Francis Moreau
2009-11-10 12:11 ` Joost Kremers
2009-11-10 14:16 ` Francis Moreau
2009-11-10 18:53 ` David Kastrup
2009-11-06 5:06 ` Barry Margolin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091108094618.GA17095@tomas \
--to=tomas@tuxteam.de \
--cc=francis.moro@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).