Python syntax in Lisp and Scheme

Alexander Schmolck a.schmolck at gmx.net
Wed Oct 15 07:28:08 EDT 2003


mertz at gnosis.cx (David Mertz) writes:

> |> Isn't it true though that the lambda can only contain a single
> |> expression and no statements?  That seems to limit closures somewhat.
> 
> David Eppstein <eppstein at ics.uci.edu> wrote previously:
> |It limits lambdas.  It doesn't limit named functions.  Unlike lisp, a
> |Python function definition can be nested within a function call, and the
> |inner function can access variables in the outer function's closure.
> 
> I don't really know Lisp, so I could be wrong.  But my understanding is
> that CL has a 'let' special form that works fine within a function
> definition.  In particular, you should be able to define inner functions
> by binding a name to a lambda, using 'let'.

Yes David's comment only applies to ancient, non-lexically scoped lisps
(elisp is the only practical example I'm aware of).

'as




More information about the Python-list mailing list