merits of Lisp vs Python

Paul Rubin http
Sun Dec 10 03:01:34 EST 2006


"Wolfram Fenske" <int2k at gmx.net> writes:
> > If Common Lisp didn't have lexically scoped variables (most Lisp
> > dialects before Scheme didn't have them) then it would be very
> > difficult to add that with macros.
> 
> Alex Mizrahi already took care of that one.

I'm not persuaded, I haven't examined his example carefully yet but it
looks like basically a reader hack.  Lexical scope in Lisp means among
other things lexical closures and (maybe I'm mistaken) it seemed to me
Alex's example didn't supply that.  I'm also unconvinced (so far) of
his description of call/cc as a Lisp macro but that's going to take me
some head scratching.

> > I just don't see a non-messy way to simulate Python generators in CL.
> > They can be done in Scheme using call/cc though.
> 
> Scheme is also a Lisp.  So?

No I don't buy that, you can't say Scheme is Lisp when it suits you to
do so and that it isn't Lisp at other times.  I'd say you can map most
of Python's semantics onto Scheme reasonably straightforwardly, but
mapping them to CL is considerably harder, macros or no macros.

> >    http://www.math.chalmers.se/~rjmh/Papers/whyfp.html
> >
> > The examples in it are pretty easy to do in Python or Scheme, but I
> > think not so easy in CL.
> 
> Anything in particular?  I'd be surprised if the solutions in Scheme
> and CL would differ very much

I took it back, I think you can do it in CL with closures (call/cc not
needed) similar to how it's done in SICP.  You could do something
similar in Python but the natural way is with generators.



More information about the Python-list mailing list