On Mon, Feb 18, 2008 at 08:07:09PM -0800, [EMAIL PROTECTED] wrote:
Scheme lists map so nicely to Python lists.
Everything is working so elegantly and clear.

Well, no.  As mentioned earlier Scheme and Python lists are very different
beasts.

I'm loathe to replace the beautifully simple (1 4 5)
with (1 . (4 . (5 . ()))) .

I would argue the exact opposite.  The cons cell is a "beautifully simple"
thing.  The array/vector is the more complicated beast that gives better
random access performance but isn't as general.

Also, the python lists are pretty much what Scheme vectors are.  The scheme
vector #(1 2 3 4 5) is basically what a Python list is.

Anyone got a good thing to say about conses? :)

You're not implementing Scheme if you don't implement cons cells.  One
example would be the association list:

  (('first . "David") ('last . "Brown") ('email . "[EMAIL PROTECTED]"))

Each element of the list is a cons cell where the car is a symbol of the
association key and the cdr is the value.  Doing this with lists would take
more space.

Another example is that Python lists can't represent circular data
structures, which Scheme/lisp lists can.  In other words, you can't
implement set-cdr! without using cons cells.

David

--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg

Reply via email to