blob: d669244d019f855626fa358cf0b6692c1662ac51 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
(load "../common")
(test (ifa (> (+ 2 2) 0) (* it 2))
8)
(test (let ((x 7))
(ifa (>= (* x x) 49)
(isqrt it)))
7)
(test (let (x y) (ifa (> x y) (print it))) :error)
(test (let ((x 5))
(ifa (< 0 (+ 3 (* 2 x)) 20) (* 100 it)))
1300)
(test (ifa (not (oddp (length '(a b c d)))) it)
4)
(test (symacrolet ((%x% 42))
(let ((y 41))
(ifa (> %x% y) it)))
42)
(test (let ((x 5))
(conda
((not (integerp x)) (list it))
((oddp (+ 2 x)) (list it))))
(7))
(test (let ((l (list 1 2 3)))
(ifa (evenp (second l))
(inc it))
l)
(1 3 3))
(test (let ((l (list 1 2 3 4 5)))
(conda
((< 2 (third l) 4)
(inc it)))
l)
(1 2 4 4 5))
(test (let* ((x 2) (y 4)
(l (list 1 2 3 4 5)))
(conda
((< x (third l) y)
(inc it)))
l)
(1 2 4 4 5))
|