The following is an attempt to compress the ,@body pattern: (mac bod (name parms . body)
`(mac ,name ,(rreduce cons (join parms (list 'body))) &))
& is a readmacro that translates to ,@body.With the bod macro when... (mac when (test . body)
`(if ,test (do ,@body)))
...becomes: (bod when (test)
`(if ,test (do &)))
rfn... (mac rfn (name parms . body)
`(let ,name nil
(set ,name (fn ,parms ,@body))))
...becomes: (bod rfn (name parms)
`(let ,name nil
(set ,name (fn ,parms &))))
There's a version of arc.arc at
http://github.com/skenney26/sarc/tree/master
that has the bod macro and a few
other macros translated to this syntax. (A few definitions had to be
juggled around too.) An updated version of as.scm can also be found
at the same url along with amp.scm which modifies the readtable for &.
(brackets.scm was used as a template for amp.scm)Perhaps this can be generalized to handle macros such as atomic that only have a rest parameter. Feedback/improvements/criticisms appreciated. |