I'm revisiting a problem I had a few months ago when developing a DSL and it was suggested that explicit renaming macros would be the easiest solution. However after reading everything macro-related I could find on the web I'm still nowhere. If someone could point me to a tutorial for the thick-headed I would be greatly appreciative.
I've found tons of info on syntax-rules, but I don't think I can do this without segment matching. I have a number of similar transformations to make and if I could understand just one I think I could figure out the rest.
I'm trying to transform...
(def (name arg ... (optional-arg value) ... *rest) body ...)
Where there can be any number of args and any number of (optional-arg value)'s followed by an optional rest argument.
Transforms into...
I managed something similar in Chicken 3 + syntax-case (with an extra level of parens around optional arguments) but cannot figure how to do the same in Chicken 4. I can't find any documentation (at least that I can understand) on explicit renaming macros. The Chicken 3 code I had is below, but it doesn't work in 4.