Hi all,

Reading the documentation on ~datum in syntax/parse, I see:

The ~datum 
<file:///usr/local/racket/doc/syntax/stxparse-patterns.html?q=syntax-case#%28form._%28%28lib._syntax%2Fparse..rkt%29._~7edatum%29%29>
 form is useful for recognizing identifiers symbolically, in contrast to the 
~literal 
<file:///usr/local/racket/doc/syntax/stxparse-patterns.html?q=syntax-case#%28form._%28%28lib._syntax%2Fparse..rkt%29._~7eliteral%29%29>
 form, which recognizes them by binding.

That makes sense to me. But then I see:

> (syntax-parse 
> <file:///usr/local/racket/doc/syntax/Parsing_Syntax.html?q=syntax-case#%28form._%28%28lib._syntax%2Fparse..rkt%29._syntax-parse%29%29>
>  (let 
> <applewebdata://EC850F88-0C7E-4179-B1EF-C18D24819433/reference/let.html#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._let%29%29>
>  ([define 
> <applewebdata://EC850F88-0C7E-4179-B1EF-C18D24819433/reference/define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29>
>  'something-else]) #'(define 
> <applewebdata://EC850F88-0C7E-4179-B1EF-C18D24819433/reference/define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29>
>  x y))
    [((~datum 
<file:///usr/local/racket/doc/syntax/stxparse-patterns.html?q=syntax-case#%28form._%28%28lib._syntax%2Fparse..rkt%29._~7edatum%29%29>
 define 
<applewebdata://EC850F88-0C7E-4179-B1EF-C18D24819433/reference/define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29>)
 var:id e:expr) 'yes]
    [_ 
<applewebdata://EC850F88-0C7E-4179-B1EF-C18D24819433/reference/stx-patterns.html#%28form._%28%28lib._racket%2Fprivate%2Fstxcase-scheme..rkt%29.__%29%29>
 'no])
'yes
> (syntax-parse 
> <file:///usr/local/racket/doc/syntax/Parsing_Syntax.html?q=syntax-case#%28form._%28%28lib._syntax%2Fparse..rkt%29._syntax-parse%29%29>
>  (let 
> <applewebdata://EC850F88-0C7E-4179-B1EF-C18D24819433/reference/let.html#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._let%29%29>
>  ([define 
> <applewebdata://EC850F88-0C7E-4179-B1EF-C18D24819433/reference/define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29>
>  'something-else]) #'(define 
> <applewebdata://EC850F88-0C7E-4179-B1EF-C18D24819433/reference/define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29>
>  x y))
    [((~literal 
<file:///usr/local/racket/doc/syntax/stxparse-patterns.html?q=syntax-case#%28form._%28%28lib._syntax%2Fparse..rkt%29._~7eliteral%29%29>
 define 
<applewebdata://EC850F88-0C7E-4179-B1EF-C18D24819433/reference/define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29>)
 var:id e:expr) 'yes]
    [_ 
<applewebdata://EC850F88-0C7E-4179-B1EF-C18D24819433/reference/stx-patterns.html#%28form._%28%28lib._racket%2Fprivate%2Fstxcase-scheme..rkt%29.__%29%29>
 'no])
'yes

I’m confused by this. It seems, based on the first sentence I quoted, that in 
the second example, in which the syntax being parsed has define bound to 
something other than the usual, the use of ~literal should make the first 
clause fail to match. And I’d have expected the examples to contrast ~datum and 
~literal, rather than exhibit the same behavior.

Could someone please explain this to me?

Thanks,
Jordan

-- 
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.

Reply via email to