Hi Guys,
What are the rules for macro guards? I’ve only seen examples with (identifier? 
#’val) being used. What about (number? #’val) or (spring? #’val)? When I try 
these I get a foo: bad syntax so I’m suspecting these can’t be used or there’s 
some trick to them. 

What I’ve been trying to create (and maybe this isn’t the right way to go about 
it) is a syntax-case that would have have various type checks as guards and 
then select the branch based on whether I’ve got an identifier or just a 
symbol, or a number or a string, etc. 

(syntax-case six ()
  [(_ arg) (identifier? #’arg) #’(identifier-handler arg)]
  [(_ arg) (symbol? #’arg) #’(symbol-handler arg)]
  [(_ arg) (string? #’arg) #’(string-handler arg)]
   …)

That sort of thing. 

Primarily I find myself running into an issue where I’m using symbols for 
lookup keys and identifiers for their reference values  and running into a wall 
of wanting the macro to go ahead and handle them differently without have the 
old “foo undefined” popping up. :) 

Kevin

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/DED7E28E-9B3D-4045-B0DC-CBD3AB11E653%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to