mirror of
https://github.com/kanaka/mal.git
synced 2024-11-11 08:56:41 +03:00
dca6b58578
- Remove most of the step5 excludes in the Makefile except for ones which don't have TCO capability at all (or the implementation is too slow): bash, make, mal, matlab. - Make perf_EXCLUDES consistent with other excludes. - Add a print-FOO target which prints the resolved value of Makefile variable FOO. For example, `make print-IMPLS` to print the list of implementations.
22 lines
364 B
Plaintext
22 lines
364 B
Plaintext
;; Testing recursive tail-call function
|
|
|
|
(def! sum2 (fn* (n acc) (if (= n 0) acc (sum2 (- n 1) (+ n acc)))))
|
|
|
|
(sum2 10 0)
|
|
;=>55
|
|
|
|
(def! res2 nil)
|
|
;=>nil
|
|
(def! res2 (sum2 10000 0))
|
|
res2
|
|
;=>50005000
|
|
|
|
|
|
;; Test mutually recursive tail-call functions
|
|
|
|
(def! foo (fn* (n) (if (= n 0) 0 (bar (- n 1)))))
|
|
(def! bar (fn* (n) (if (= n 0) 0 (foo (- n 1)))))
|
|
|
|
(foo 10000)
|
|
;=>0
|