blob: e6daad3a49efc544dfa39bbcc12cd81362ac58a4 (
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
|
(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 @,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 @,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))))
|