Re: [racket-users] Behavior of nested ellipses

2018-03-28 Thread Justin Pombrio
> I don’t see why one is better than the other. I was surprised that the ellipsis which 'x' varies over changes between the pattern and the template. But it looks like no one else has the same intuition, so it's fine :-). > Yes. See this part of the documentation of `syntax`: That's clear, t

Re: [racket-users] Behavior of nested ellipses

2018-03-28 Thread Matthew Flatt
Just to answer some parts of the original question: At Tue, 27 Mar 2018 13:01:54 -0700 (PDT), Justin Pombrio wrote: > 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: > [...] > Is this the expecte

Re: [racket-users] Behavior of nested ellipses

2018-03-28 Thread Matthias Felleisen
> On Mar 27, 2018, at 11:58 PM, Justin Pombrio wrote: > > Matthias: the algorithm I was thinking of is the Macro-by-Example algorithm > that Ryan pointed out, which is neither of yours. Decompose the environment > at the outer ellipsis. I take back my claim that it's the most obvious > algori

Re: [racket-users] Behavior of nested ellipses

2018-03-27 Thread Justin Pombrio
I think I found a clearer way of talking about this. This rule: (define-syntax-rule (test (x y ...) ...) '(((x y) ...) ...)) Has more than one possible meaning. But it can be clarified using explicit subscripts. It could mean either this (which is what I expected): (define-syntax-rule

Re: [racket-users] Behavior of nested ellipses

2018-03-27 Thread Ryan Culpepper
On 03/27/2018 11:46 PM, Ryan Culpepper wrote: On 03/27/2018 10:01 PM, Justin Pombrio wrote: 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: [...] BTW, it looks like Macro-By-Example[1] describ

Re: [racket-users] Behavior of nested ellipses

2018-03-27 Thread Ryan Culpepper
On 03/27/2018 10:01 PM, Justin Pombrio wrote: 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 [(_ (

Re: [racket-users] Behavior of nested ellipses

2018-03-27 Thread Matthias Felleisen
> On Mar 27, 2018, at 4:01 PM, Justin Pombrio wrote: > > 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