First, do we really need multiple macro patterns for mu
like Scheme uses in its hyenic macros? It seems we do in order to implement things like if
.
Second, how does currying fit into the concept of matching different patterns? Scheme takes the first pattern that matches. However, with currying there could be more parameters than the pattern requires, or fewer and it could still match. Clearly, it's not hard to have more parameters and call the result of the macro with those parameters. It is hard to have two few arguments because then we must tag values from different places to perform something like lazy evaluation. This seems to go beyond macros.
Another option is to not do any currying in macros because it might not be meaningful. But it would be possible to simulate currying where appropriate.
Patterns must match completely the arguments given. So no currying happens. However macros can be made to implement currying by tricks as in this example if
definition which allows currying the guard expression.
(define if
(mu ()
( (<guard> <then> <else>)
((eq? <guard> #f) <else> <then>))
( (<guard> <then>)
((eq? <guard> #f) #void <then>))
( (<guard>)
(mu ()
( (<then>)
((eq? <guard> #f) #void <then>))
( (<then> <else>)
((eq? <guard> #f) <else> <then>))
))))
jwalker@cs.oberlin.edu |