On Aug 7, 2014, at 12:43 PM, Alexander D. Knauth <[email protected]> wrote:
> (define-syntax-class (thing fs)
> #:attributes (norm)
> [pattern x #:when (empty? fs)
> #:with norm #'x]
> [pattern (x ...)
> #:declare x (thing (rest fs))
> #:with f (first fs)
> #:with norm #'(f x.norm ...)]
> [pattern x #:with norm #'x])
> (syntax-parse #'(x [f1 f2 f3] (1 2 3 4) (5 (6 7) 8))
> [(_ [f ...] . x)
> #:declare x (thing (syntax->list #'(f ...)))
> #'x.norm])
> ; #<syntax (f1 (f2 1 2 3 4) (f2 5 (f3 6 7) 8))>
Fantastic! I’ll have to study syntax-class more closely. Quite fabulous. Thanks
so much!
-Kevin
____________________
Racket Users list:
http://lists.racket-lang.org/users