Professor O'Donnell mentioned in class a function which encapsulates the concept of recursion. I tried to come up with it from memory, and I got
(define Y
(lambda (f)
(lambda (x)
(f f x))))Then to, e.g., compute n! recursively, you would have to do
((Y (lambda (f x)
(if (= x 1)
1
(* x (f f (- x 1))))))
n)
So I'm wondering if that's the correct definition of the function. |
as combinators by Ben Wolfson, 2001, Nov 17
to: