blob: 26d5417b7eaa0b7df53f1c66bf34fb7a1e38edf5 (
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
|
(let ((nullsym nil)
(sym 's)
(atom "abc")
(cons '(x y z))
(dwim '[]))
(tree-bind (x y (op arg)) ^(a b @,nullsym)
(assert (eq op 'sys:var))
(assert (eq arg nullsym)))
(tree-bind (x y (op arg)) ^(a b @,sym)
(assert (eq op 'sys:var))
(assert (eq arg sym)))
(tree-bind (x y . (op arg)) ^(a b . @,sym)
(assert (eq op 'sys:var))
(assert (eq arg sym)))
(tree-bind (x y (op arg)) ^(a b @,atom)
(assert (eq op 'sys:var))
(assert (eq arg atom)))
(tree-bind (x y . (op arg)) ^(a b . @,atom)
(assert (eq op 'sys:var))
(assert (eq arg atom)))
(tree-bind (x y (op arg)) ^(a b @,cons)
(assert (eq op 'sys:expr))
(assert (eq arg cons)))
(tree-bind (x y . (op arg)) ^(a b . @,cons)
(assert (eq op 'sys:expr))
(assert (eq arg cons)))
(tree-bind (x y (op arg)) ^(a b @,dwim)
(assert (eq op 'sys:expr))
(assert (eq arg dwim)))
(tree-bind (x y . (op arg)) ^(a b . @,dwim)
(assert (eq op 'sys:expr))
(assert (eq arg dwim)))
(tree-bind (x y (op arg . tail)) ^(a b (sys:expr ,sym . foo))
(assert (eq op 'sys:expr))
(assert (eq arg sym))
(assert (eq tail 'foo)))
(tree-bind (x y (op arg0 arg1)) ^(a b (sys:expr ,sym foo))
(assert (eq op 'sys:expr))
(assert (eq arg0 sym))
(assert (eq arg1 'foo)))
(tree-bind (x y (op)) ^(a b (sys:expr))
(assert (eq op 'sys:expr))))
|