Segment matching is not implemented in the Chicken 4 implementation of
syntax-rules (I get an error saying just that). When this question
came up a while back Felix told me that it would not be trivial to
implement and suggested I use explicit renaming.
If I remove the '...' after arg like so...
(define-syntax def
(syntax-rules (*args)
((def (name arg ((opt val) ...) *args) body ...)
(define (name arg #!optional (opt val) ... #!rest args) body ...))))
and test it with...
(def (a x ((y 2) (z 3)) *args) (apply + (append (list x y z) args)))
Besides
the fact that it only works for a single required argument (and I'd
have to write 30+ patterns to support only up to 10 arguments), I get
the following error about 'args' being unbound.
Warning: the following toplevel variables are referenced but unbound:
args (in a)
Jack Trades