Re: [racket-users] Odd behavior of syntax-case

2016-01-28 Thread Matthew Flatt
The pattern matcher in `syntax-case` is less powerful than the one in `syntax-parse`. The pattern (_ trash-left ... save-the-world . trash-right) can match `save-the-world` only against the last item in a list --- or against the first of the last pair for a non-list. With `syntax-parse`, as

Re: [racket-users] Odd behavior of syntax-case

2016-01-28 Thread reilithion
Thanks for the explanation! Does this mean that syntax-case simply doesn't have a way to write a pattern that matches save-the-world anywhere in the list? I'm also curious why these two constructs have such different pattern matchers. Is it just that syntax-parse is newer and will one day

Re: [racket-users] Odd behavior of syntax-case

2016-01-28 Thread Matthew Flatt
That's right: `syntax-case` doesn't have a way to write that as a pattern. And yes: `syntax-parse` is newer and will one day supplant `syntax-case` (more completely than it has already). At Thu, 28 Jan 2016 06:03:46 -0800 (PST), reilithion wrote: > Thanks for the explanation! Does this mean that

[racket-users] Odd behavior of syntax-case

2016-01-27 Thread reilithion
I was trying to write a macro today (I'm not too good at writing macros yet) and I ran up against a wall when I realized that syntax-case wasn't behaving the way I expected. I boiled down the behavior to the following test case: #lang racket/base (require (for-syntax racket/base)) ;; Intended