Linked lists (was Re: Typing system vs. Java

Alex Martelli aleax at aleax.it
Thu Aug 9 12:15:49 CEST 2001


"Paul Foley" <see at below> wrote in message
news:m2itfyw0r3.fsf at mycroft.actrix.gen.nz...
> On Wed, 8 Aug 2001 11:10:47 +0200, Alex Martelli wrote:
>
> > This will blow up if alist isn't a proper lisp-ish list, as
> > build with "def cons(car,cdr): return car, cdr" and a () (or
>
> Tuples are immutable.  [conses aren't]

Right, not in Lisp (nor Scheme) -- that's what one gets from
dabbling in FP (immutable-data rules!-) and not practising any
Lisp (nor Scheme) for too long.  You do need to correct my def
of cons to:
    def cons(car, cdr): return [car,cdr]
if you want to be able to modify the car and/or cdr of
a cons cell, obviously.


> > Python does no tail-recursion optimization, and well-written
>
> Neither does Lisp.  Well, most Common Lisp implementations do, with
> appropriate (non-default) optimisation settings, but it's not required
> and a bad idea to rely on it.  [Inappropriate use of cdr recursion is
> a good way to detect those conniving Schemers :-)]

I'll have to confess to being a schemer, having been detected,
but I was sure there was documented tail-recursion optimization
in some Lisp I used back in the dark ages (late-70's) -- maybe
it's a false-memory.


Alex






More information about the Python-list mailing list