You can use ~and to bind it to an attribute. (syntax-parse #'(foo) [(_ (~optional (~and #:kw kw))) (attribute kw)]) ; => #f
> On Apr 17, 2015, at 05:38, Konrad Hinsen <konrad.hin...@fastmail.net> wrote: > > Hi everyone, > > my question looks like something straightforward, but I have been > reading through the documentation for a while without finding anything > clearly helpful. > > I want to define some syntax with an optional keyword but no arguments > behind it. Something like #:mutable in struct. The pattern seems > obvious: > > (~optional #:my-keyword) > > but I don't see how I can detect the presence or absence of the > keyword in the code that I generate. There is no attribute for > which I could define a default. > > Konrad. > > > -- > 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. -- 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.