diff options
Diffstat (limited to 'tests/lambda.lisp')
| -rw-r--r-- | tests/lambda.lisp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/lambda.lisp b/tests/lambda.lisp new file mode 100644 index 0000000..5c93bdb --- /dev/null +++ b/tests/lambda.lisp @@ -0,0 +1,12 @@ +(defun Y (f) + (funcall + (lambda (g) (funcall g g)) + (lambda (h) + (funcall f (lambda args (apply (funcall h h) args)))))) +(defun fibo-impl (self) + (lambda (n) + (if (<= n 2) + 1 + (+ (funcall self (- n 1)) (funcall self (- n 2)))))) +(defvar fibo (Y #'fibo-impl)) +(assert (= 55 (funcall fibo 10))) |
