At Thu, 1 Dec 2016 15:23:29 -0800 (PST), Matthew Butterick wrote: > `syntax?` is #t no matter what. > > `syntax-source-module` is close, but according to the docs, it can still be > #f even if the syntax object has a lexical context. > > I considered this: > > (define (no-lexical-context? stx) > (equal? stx (strip-context stx))) > > But `equal?` doesn't work here.
Assuming that "without lexical context" means "no scopes"[*], I don't think there's a simpler way right now than walking through the syntax object and making sure that each scope set is empty. And maybe there's no easier way to check for an empty scope set than using `bound-identifier=?` on an identifier with a scope set to test and an identifier that definitely has an empty scope set. [*] I see that the Guide's section 17.3.2 says "no lexical context." Maybe that would be better as "an empty lexical context" or even "an empty set of scopes". > (Side question: does `equal?` ever return > #t for syntax objects, other than the trivial case of `(equal? stx stx)`?) No, `equal?` is `eq?` for syntax objects. -- You received this message because you are subscribed to the Google Groups "Racket Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-dev+unsubscr...@googlegroups.com. To post to this group, send email to racket-dev@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-dev/5840cf60.c952620a.95b47.2e94SMTPIN_ADDED_MISSING%40gmr-mx.google.com. For more options, visit https://groups.google.com/d/optout.