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
|
(defmacro with-hash-iter ((name hash-form : key val) . body)
(let ((hash (gensym))
(iter (gensym))
(next (gensym)))
^(let* ((,hash ,hash-form)
(,iter (hash-begin ,hash))
,*(if key ^((,key)))
,*(if val ^((,val))))
(flet ((,name ()
,(if (not (or key val))
^(hash-next ,iter)
^(let ((,next (hash-next ,iter)))
,*(if key ^((set ,key (car ,next))))
,*(if val ^((set ,val (cdr ,next))))
,next))))
,*body))))
|