I'm surprised by the behavior of using a pattern variable under one set of ellipses in the pattern, and under two sets of ellipses in the template:
#lang racket (require (for-syntax syntax/parse)) (define-syntax (test stx) (syntax-parse stx [(_ (x y ...) ...) #''(top (list (x y) ...) ...)])) (test (a 1 2 3) (b 4 5 6) (c 7 8 9)) I would expect this to produce: '(top (list (a 1) (a 2) (a 3)) (list (b 4) (b 5) (b 6)) (list (c 7) (c 8) (c 9))) But instead, it produces: '(top (list (a 1) (b 2) (c 3)) (list (a 4) (b 5) (c 6)) (list (a 7) (b 8) (c 9))) I'm surprised by this for two reasons: - What I thought was the obvious implementation for matching/substituting with ellipses produces the top answer. - It breaks some properties that I would expect ellipses to have, such as: (define-syntax-rule (test (P ...)) (list Q ...)) (test (T1 T2)) === (define-syntax-rule (test P P*) (list Q Q*)) (test T1 T2) ; for all patterns P and templates Q and terms T1 and T2, where P* and Q* are a renamed version of P and Q. Is this the expected behavior? And is there a good reason for it? Cheers, Justin -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.