Re: [racket-users] Syntax pattern to match a sequence with x identical elements?

2019-11-10 Thread Jonathan Simpson
I verified that the pre-release version 7.4.0.902 resolves my issue with ~between. With that fix I was able to complete the macro I was working on. Thanks again for the advice and the quick response by the Racket dev team! -- Jon On Sunday, October 13, 2019 at 10:57:17 AM UTC-4, Jonathan Simpso

Re: [racket-users] Syntax pattern to match a sequence with x identical elements?

2019-10-13 Thread Jonathan Simpson
Thanks Alexis. To anyone who is in a position to look into this: it would be great if this can make it into the upcoming 7.5 release. -- Jonathan On Sunday, October 13, 2019 at 4:08:00 AM UTC-4, Alexis King wrote: > > I think that error is a bug in syntax/parse. I have reported it here: > > ht

Re: [racket-users] Syntax pattern to match a sequence with x identical elements?

2019-10-13 Thread Alexis King
I think that error is a bug in syntax/parse. I have reported it here: https://github.com/racket/racket/issues/2856 > On Oct 12, 2019, at 21:45, Jonathan Simpson wrote: > > I'm not sure exactly why my syntax class wasn't working, but it is working

Re: [racket-users] Syntax pattern to match a sequence with x identical elements?

2019-10-12 Thread Jonathan Simpson
I'm not sure exactly why my syntax class wasn't working, but it is working now. I had an extra set of parentheses around the ~between pattern, so it may have been related to that. Whatever the case may be, the non-splicing syntax class is working now. I am very close to getting everything worki

Re: [racket-users] Syntax pattern to match a sequence with x identical elements?

2019-10-12 Thread Alexis King
I believe your two syntax classes are identical, except for the fact that the splicing variant will not be allowed as a single term pattern. Therefore, I don’t think there’s ever any reason to prefer the splicing version. I tried an example using your mag-lvl syntax class with ~between, and it w

Re: [racket-users] Syntax pattern to match a sequence with x identical elements?

2019-10-12 Thread Jonathan Simpson
Regarding my custom syntax-class issue, I realize now that it is probably because ~between only accepts splicing syntax classes. So, I created one that matches my regular syntax class. I'm not 100 percent sure that these are interchangeable in my use case though: (define-syntax-class mag-lvl

Re: [racket-users] Syntax pattern to match a sequence with x identical elements?

2019-10-11 Thread Jonathan Simpson
Thank you Alexis for the clear explanation. I now understand how to use ~between and it is working for me. One small hitch I encountered is a custom syntax class I defined doesn't work in the ~between statement but works elsewhere within the same syntax pattern. This isn't a huge issue for me a

Re: [racket-users] Syntax pattern to match a sequence with x identical elements?

2019-10-11 Thread wanderley.guimar...@gmail.com
+1 for adding the explanation to the Guide. On Fri, Oct 11, 2019 at 9:02 AM David Storrs wrote: > > Alexis, is there any way that we can get this explanation and some of > the ones you've given me added to the Guide? I've tried to add things > to the documentation before, or even just submit typ

Re: [racket-users] Syntax pattern to match a sequence with x identical elements?

2019-10-11 Thread David Storrs
Alexis, is there any way that we can get this explanation and some of the ones you've given me added to the Guide? I've tried to add things to the documentation before, or even just submit typo reports but, as I've mentioned before, the way the docs are organized (random little snippets scattered

Re: [racket-users] Syntax pattern to match a sequence with x identical elements?

2019-10-10 Thread Alexis King
tl;dr: You need to use an ellipsis, so your pattern should be ((~between x:integer 3 3) ...). A (much) more detailed explanation of why follows. ~between is an ellipsis-head pattern. The most common ellipsis-head pattern, ~optional, also works as a plain head pattern, but ~between does not. What

[racket-users] Syntax pattern to match a sequence with x identical elements?

2019-10-10 Thread Jonathan Simpson
This seems like it should be simple but I've never been able to figure out how to do this. What I've been doing instead is this: (x:integer ...+) to match two or more integers. (x:integer y:integer ...+) to match three or more. And so on. I'm at a point now where I need to build patterns dynam