Re: [racket-users] Lost in ellipsis depths

2015-09-03 Thread Konrad Hinsen
Jens Axel Søgaard writes: > Here are two variations: ... Alexander D. Knauth writes: > To make it look a little less messy, here's what I would do for stuff like > this: ... Matthias Felleisen writes: > I think you want either this: ... Ryan Culpepper writes: > Here's one more solution

Re: [racket-users] Lost in ellipsis depths

2015-09-02 Thread Ryan Culpepper
Here's one more solution, using "template metafunctions" (inspired by Redex's metafunctions). And yes, most of the point of template metafunctions is to have something that cooperates with ellipses like you want. > (require syntax/parse syntax/parse/experimental/template

Re: [racket-users] Lost in ellipsis depths

2015-09-02 Thread Matthias Felleisen
I think you want either this: (syntax-parse #'(foo a b c) [(f:id s:id ...) (map (λ (s) (format-id #'f "foo-~a" s)) (syntax->list #'(s ...)))]) or that: (syntax-parse #'(foo a b c) [(f:id s:id ...) #'(list (format-id #'f "foo-~a" #'s) ...)]) On Sep 2, 2015, at 7:00 AM, Konrad Hinsen wr

Re: [racket-users] Lost in ellipsis depths

2015-09-02 Thread Alexander D. Knauth
> On Sep 2, 2015, at 7:09 AM, Konrad Hinsen wrote: > > Konrad Hinsen writes: > >> In fact, what I want is do something like map over the ellipsis pattern, >> but I haven't seen any example for doing this. > > Well, map actually works: > > (syntax-parse #'(foo a b c) >[(f:id s:id ...) >

Re: [racket-users] Lost in ellipsis depths

2015-09-02 Thread Jens Axel Søgaard
Here are two variations: #lang racket (require syntax/stx syntax/parse racket/syntax unstable/sequence) (syntax-parse #'(foo a b c) [(f:id s:id ...) (define foo-s* (stx-map (λ (x) (format-id #'f "foo-~a" x)) #'(s ...))) (with-syntax ([(foo-s ...) foo-s*]) #'(list foo-s ...))]) (sy

[racket-users] Lost in ellipsis depths

2015-09-02 Thread Konrad Hinsen
Konrad Hinsen writes: > In fact, what I want is do something like map over the ellipsis pattern, > but I haven't seen any example for doing this. Well, map actually works: (syntax-parse #'(foo a b c) [(f:id s:id ...) (with-syntax ([(foo-s ...) (map (λ (x) (format

[racket-users] Lost in ellipsis depths

2015-09-02 Thread Konrad Hinsen
Hi everyone, I am working on what I consider a simple macro, but after reading all of the macro-related documentation twice, I still don't see how to do this. I want to transform (foo a b c) to (list foo-a foo-b foo-c) Here is my best attempt (using syntax/parse): (syntax-parse #'(foo a