Skip to main content
2 of 2
define $\lambda$-operator

I would recommend Structure and Interpretation of Computer Programming by Hal Abelson from M.I.T.

One of the first things I remember learning in SCHEME (a dialect of LISP) was that the $\lambda$-operator was a primitive operator to define a function and that you could write functions which could take functions as arguments and could return functions as results. You could, in fact, nest functions even deeper than this.

An example: writing a function called power which when passed a value x returned a function which when passed a value would return the answer value^x. Thus, (defun 'squareit (power 2)) and (defun 'cubeit (power 3)), and (defun 'sqrtit (power 0.5)) were the simple ways to define functions such as square, cube, and square root.

(defun (power x) (lambda (y) (exp (* x log(y) ) ) )

(defun 'squareit (power 2))

(defun 'cubeit (power 3))

(defun 'sqrtit (power 0.5)) 

This should show you how you can return a function of a variable as the result of a function that takes another variable to help define a function like exponentiate that takes two variables (the base and the exponent).