On Mon, Mar 15, 1999 at 10:27:16 +0100, Balazs Scheidler wrote:
> On 12 Mar 1999, Niels [ISO-8859-1] M�ller wrote:
> > Everything is executed from left to right. Functions really have only
> > one argument; but a function that takes one argument and returns a new
> > function accepting the next argument acts a lot like a function of two
> > arguments. To be precise, (a b c) is a shorthand for ((a b) c) and
> > (lambda (a b) c) is a shorthand for (lambda (a) (lambda (b) c)), but
> > that is not very important now.
> 
> I don't fully understand the above description. (maybe because I don't
> know LISP enough) what does "lambda" mean?

I'm not very well-versed in functional programming, but from what I
understand of it, you should probably read something like "the unnamed
function" whereever you see "lambda".

Lambda is a way to bind an expression with free variables in it, say "x+4",
to form a (nameless) function. 
"(lambda (x) (+ 4 x))" is the the function of one argument that adds 4 to
its argument (note that this function is not given a name).

In addition to lambda, Niels refers to what's known as Currying, a technique
to construct multi-argument functions from single-argument ones.

For instance "(lambda (x) (lambda (y) (+ x y)))" is both the function of two
arguments "add x and y" and the family of addition functions with one
argument y "add 0 and y", "add 1 and y", ... ; you can get a particular
member of this family by providing an x; this is called partial evalution
(right Niels?).

For instance "((lambda (x) (lambda (y) (+ x y))) 3)" is an expression that
               \-------------------------------/ |
                            |                    +--\
                            |                       | 
yields as its result the unnamed function that adds 3 to its (single)
argument.
And "((lambda (x) (lambda (y) (+ x y)) 3 4))" is a convulted way of saying
"7".

HTH,
Ray
-- 
J.H.M. Dassen                 | RUMOUR  Believe all you hear. Your world may  
[EMAIL PROTECTED]      | not be a better one than the one the blocks   
                              | live in but it'll be a sight more vivid.      
                              |     - The Hipcrime Vocab by Chad C. Mulligan  

Reply via email to