> On May 29, 2019, at 11:09 AM, Sorawee Porncharoenwase
> wrote:
>
> (foo a) ;=> 1
> (foo "a") ;=> 2
> (foo 10) ;=> 3
> (foo 'a) ;=> 4
> (foo (bar x)) ;=> 5
Ah… thanks so much for the explanation. That’s put me much closer (I hope!) to
the solution I’m after. A bit of stumbling around through
The issue is that #'arg will always be a syntax object. An identifier is a
kind of syntax object, so it makes sense to test (identifier? #’arg).
However, (symbol? #’arg) and (string? #’arg) will always fail.
Suppose then that you invoke the macro with "1" as the operand, it would
fail every case i
#'arg is a syntax object, therefore (number? #'arg) or (string? #'arg) will
always be false. If you are trying to dispatch based on literals, you could
use e.g. (number? (syntax-e #'arg)) to identify a numeric literal. But it
is not very common that a macro handles a numeric literal differently
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 creat
4 matches
Mail list logo