| Variable bindings should be regular
expressions, being functions on the
matched groups. E.g., this should generalize
car, cadr, caddr, etc. for any number
of "a"s and "d"s: ```
(def /c([ad]*)r/ (x)
(if
(is $1 "")
x
(is (head $1) "a")
(head (c{(tail $1)}r x))
(is (head $1) "d")
(tail (c{(tail $1)}r x))))
```
or better yet:```
(def /c([ad]*)r/ (x)
(if
(is $1 "")
x
((if (is (head $1) "a")
head
tail)
(c{(tail $1)}r x))))
```
and even:```
(mac /def(.*)/ (name . rest)
`(= ,name (,$1 ,@rest)))
```
thus:```
(defcons x 1 2) === (= x (cons 1 2))
```
Of course, this should be adapted to
a less Perl-like syntax. |