Commit | Line | Data |
---|---|---|
dca6b585 JM |
1 | ;; Test recursive non-tail call function |
2 | ||
3 | (def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1)))))) | |
4 | ||
5 | (sum-to 10) | |
6 | ;=>55 | |
7 | ||
8 | ;;; no try* yet, so test completion of side-effects | |
9 | (def! res1 nil) | |
10 | ;=>nil | |
11 | ;;; For implementations without their own TCO this should fail and | |
12 | ;;; leave res1 unchanged | |
13 | (def! res1 (sum-to 10000)) | |
14 | res1 | |
15 | ;=>nil |