On Sunday, October 23, 2016 at 1:14:56 PM UTC-7, Ryan Culpepper wrote: > > > The easiest fix is to add the #:commit option to the `remap-entry` > syntax class. Then when `remap-entry` succeeds the first time, it throws > away the choice points it created, so the repeated pattern is never > considered. >
Ok that makes sense and I hadn't realized it. Easy fix! [...] > > 1. A term like `(a <- blend)` will match the first pattern and treat > `blend` as a `remap:id`. If you don't want that to happen, there are two > ways to prevent it. One is to define a syntax class like `id` that > excludes all of the reserved words like `<-` and `blend` and use that > for pattern variables like `remap`. The other is to reorder the patterns > and use cut (~!): > > (pattern (source:id <- blend ~! remap:id > extras:remap-entry-extra-params)) > (pattern (source:id <- remap:id extras:remap-entry-extra-params)) > This one is surprising. I thought that listing 'blend' as a datum-literal would prevent the more general 'remap:id from matching it. It's easy to re-order the patterns, fortunately. > 2. `format-id` is useful for creating identifiers. > Ah, yes, awareness of 'format-id' is low among us here, I'll introduce it. > Ryan Thanks! -- 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.