| From arc.arc: (mac on (var s . body)
(if (is var 'index)
(err "Can't use index as first arg to on.")
(w/uniq gs
`(let ,gs ,s
(forlen index ,gs
(let ,var (,gs index)
,@body))))))
But of course you can't access tables by index. Here's how I rewrote it: (mac on (var expr . body)
(if (is var 'index)
(err "Can't use index as first arg to on.")
`(let index 0
(each ,var ,expr
,@body
(zap [+ 1 _] index)))))
Incidentally, I see the seemingly-redundant "let ,gs" in macros all over arc.arc. Anybody know why it's there? I didn't want to propagate it without understanding what it does. |