blob: 7b3d1cc09dc040a94b839aca47b04855eced507d (
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
|
(%defun list* args
(if (null (cdr args))
(car args)
(cons (car args)
(apply 'list* (cdr args)))))
(%defmacro let* args
(let ((form (car args)))
(let ((bindings (car (cdr form)))
(body (cdr (cdr form))))
(if (null bindings)
(list* 'let nil body)
(let ((first-binding (car bindings))
(rest (cdr bindings)))
(list 'let
(list first-binding)
(list* 'let* rest body)))))))
(%defmacro cond args
(let* ((form (car args))
(clauses (cdr form))
(clause (car clauses))
(rest (cdr clauses)))
(if (null clauses)
nil
(list 'if
(car clause)
(cons 'progn (cdr clause))
(cons 'cond rest)))))
|