aboutsummaryrefslogtreecommitdiff
path: root/tests/tailcall.lisp
blob: 1aa5e38d109c1a1664d15db6efb18a6c2ff3c9e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
(defun is-even (x)
  (if (= x 0)
    #t
    (is-odd (- x 1))))

(defun is-odd (x)
    (is-even (- x 1)))

(assert (is-even 10))
(assert (is-even 0))
(assert (is-odd 1))
(assert (is-even 2))

(defun cnt-down (x)
  (if (= x 0)
    #t
    (progn
      (cnt-down (- x 1)))))