I’m interested in using syntax-parse to restructure the form (x (y … (z …) …)) but my coding of syntax-parse appears to be matching the (z …) as a y. I must be doing something wrong!
Here’s the code: #lang racket (require (for-syntax syntax/parse)) (define-syntax (x stx) (syntax-parse stx [(_ (y ... (z ...) ...)) #'(xf (yf y ... (zf z ...) ...))])) (define (xf . xs) (list xs)) (define (yf . ys) (list ys)) (define (zf . zs) (list zs)) (x (1 2 3 (4 5 6) 7 8)) Which is expanding to: Expansion finished (module anonymous-module racket (#%module-begin (require (for-syntax syntax/parse)) (define-syntax (x stx) (syntax-parse stx [(_ (y ... (z ...) ...)) #'(xf (yf y ... (zf z ...) ...))])) (define (xf . xs) (list xs)) (define (yf . ys) (list ys)) (define (zf . zs) (list zs)) (xf (yf 1 2 3 (4 5 6) 7 8)))) I’m expecting (xf (yf 123 (zf 4 5 6) 7 8)))) —Kevin ____________________ Racket Users list: http://lists.racket-lang.org/users