proper lexical scoping now woo
This commit is contained in:
parent
ce9489b5d2
commit
27df5f8ce0
13 changed files with 349 additions and 45 deletions
17
test.lisp
17
test.lisp
|
|
@ -1,17 +0,0 @@
|
|||
(def fib-iter (fn (n a b)
|
||||
(if (= n 0)
|
||||
a
|
||||
(fib-iter (- n 1) b (+ a b)))))
|
||||
(def fib (fn (n) (fib-iter n 0 1)))
|
||||
|
||||
(write "(fib 50) = ")
|
||||
(println (fib 50))
|
||||
|
||||
(def sum
|
||||
(fn (n acc)
|
||||
(if (= n 0)
|
||||
acc
|
||||
(sum (- n 1) (+ n acc)))))
|
||||
|
||||
(write "(sum 1000000) = ")
|
||||
(println (sum 1000000 0))
|
||||
Loading…
Add table
Add a link
Reference in a new issue