summaryrefslogtreecommitdiffstats
path: root/tests/012/let.tl
blob: 36a506cad2dfeb87659513ab060288b98e7f69ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
(load "../common")

(test
  (letrec ((a (progn (set b 2 c 3) 1))
           (b)
           (c nil)
           (d (+ 3 a)))
   (list a b c d))
  (1 2 nil 4))

(test
  (letrec ((a (lcons 0 b))
           (b (lcons 1 a)))
    (take 10 a))
  (0 1 0 1 0 1 0 1 0 1))

(test
  (letrec ((even (do if (zerop @1) t [odd (pred @1)]))
           (odd (do if (zerop @1) nil [even (pred @1)])))
    (list [even 16] [even 11] [odd 1]))
  (t nil t))