Re: ellipsis & dot in `syntax-case` pattern

Matthew Flatt <mflatt-sDh8Nw2yj/[email protected]>
Newsgroups gmane.comp.lang.racket.user,gmane.lisp.scheme.plt
Message-ID <[email protected]>
To augment Ryan's answer, the docs for the

 (pattern ... pattern ellipsis pattern ... . pattern)

production specify that the final `pattern` never matches a syntax
object whose datum is a pair.

I'd say there's a slight problem with the documentation here, in that
it assumes that the final `pattern` isn't itself a parenthesized
pattern. I'll fix that.

At Wed, 30 May 2018 20:12:02 -0700, Matthew Butterick wrote:
> According to the syntax-pattern grammar in the docs for `syntax-case` [1] it 
> should be possible to use an ellipsis and a dot in the same syntax pattern. 
> Yet this pattern fails to match the input. Why?
> 
> #lang racket
> (syntax-case #'(a "x" b) ()
>   [(left ... "x" . right) #t]
>   [else #f]) ; #f
> 
> (I know that `syntax-parse` will handle it correctly, but I'm still curious 
> what I'm missing about the behavior of `syntax-case`.)
> 
> #lang racket
> (require syntax/parse)
> (syntax-parse #'(a "x" b)
>   [(left ... "x" . right) #t]
>   [else #f]) ; #t
> 
> 
> [1] 
> https://docs.racket-lang.org/reference/stx-patterns.html?q=syntax-case#%28form.
> _%28%28lib._racket%2Fprivate%2Fstxcase-scheme..rkt%29._syntax-case%29%29 
> <https://docs.racket-lang.org/reference/stx-patterns.html?q=syntax-case#(form._
> ((lib._racket/private/stxcase-scheme..rkt)._syntax-case))>
> 
> -- 
> 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+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
> For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.