diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lambdarec.lisp | 6 | ||||
-rw-r--r-- | tests/lambdarec.out | 25 |
2 files changed, 30 insertions, 1 deletions
diff --git a/tests/lambdarec.lisp b/tests/lambdarec.lisp index 69b830c..a6caa55 100644 --- a/tests/lambdarec.lisp +++ b/tests/lambdarec.lisp @@ -1,6 +1,10 @@ +#include "stdlib.lisp" + (define fibo (n) (let ((helper (lambdarec rec (m a b) - (if (= m n) b (rec m b (+ a b)))))) + (if (= m n) b (rec (+ m 1) b (+ a b)))))) (if (<= n 0) 0 (if (<= n 2) 1 (helper 2 1 1))))) + +(for 1 25 (lambda (i) (print (fibo i)))) diff --git a/tests/lambdarec.out b/tests/lambdarec.out new file mode 100644 index 0000000..14950e3 --- /dev/null +++ b/tests/lambdarec.out @@ -0,0 +1,25 @@ +1 +1 +2 +3 +5 +8 +13 +21 +34 +55 +89 +144 +233 +377 +610 +987 +1597 +2584 +4181 +6765 +10946 +17711 +28657 +46368 +75025 |