From 2cafab14203878f355a531fc6a3763881a52b108 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Mon, 18 Nov 2019 23:18:26 +0100 Subject: Notes/ideas and example tests for recursive functions --- tests/letrec.lisp | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 tests/letrec.lisp (limited to 'tests/letrec.lisp') diff --git a/tests/letrec.lisp b/tests/letrec.lisp new file mode 100644 index 0000000..52a7de9 --- /dev/null +++ b/tests/letrec.lisp @@ -0,0 +1,6 @@ +(define fibo (n) + (let ((helper (lambda (m a b) + (if (= m n) b (helper m b (+ a b)))))) + (if (<= n 0) 0 + (if (<= n 2) 1 + (helper 2 1 1))))) -- cgit v1.2.3-54-g00ecf