Of what use is 'lambda'???

Jonadab the Unsightly One jonadab at bright.net
Sun Sep 24 07:01:12 EDT 2000


ge at nowhere.none (Grant Edwards) wrote:

> Really?  In Scheme, lambda is the only way to create a
> function. There is some syntactic sugar that lets you leave out
> the actual string "lambda" if you want, but I always leave it in.
> 
> Does elisp have a non-lambda predicate to create functions?

The usual is defun...

(defun some-symbol (arglist)
   (some lists to process)
   (that do (some useful) things))

If you delve into the inner workings you will ultimately find 
that lambda is technically involved, but for all practical
elisp-writing purposes you don't need to know that.  The
only real purpose of lambda in elisp is if you want to
circumvent binding your function to a symbol.  But I have
yet to be made to understand how it harms a function to
be bound to a symbol.  Functions *like* being bound to 
symbols.  It gives them a nice home, where you can always
find them -- which improves code reusability.  I will,
however, admit that I haven't messed with mapcar enough
to say for sure that I wouldn't want lambda for that.

- jonadab



More information about the Python-list mailing list