aboutsummaryrefslogtreecommitdiff
path: root/tests/lisp/lambda.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lisp/lambda.lisp')
-rw-r--r--tests/lisp/lambda.lisp12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/lisp/lambda.lisp b/tests/lisp/lambda.lisp
new file mode 100644
index 0000000..5c93bdb
--- /dev/null
+++ b/tests/lisp/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)))