Sure. For example:
#lang racket
(require syntax/parse/define
rackunit)
(define-syntax-parser foo
[(_ arg:id)
#''arg]
[(_ arg:expr)
#'arg])
(check-eqv? (foo 10) 10)
(check-eq? (foo hello) 'hello)
(check-pred procedure? (foo (λ (x) (* 2 x
-Philip
On Sat, Sep 15, 2018 at
Hi guys,
Is there a way to define a macro so that an argument will be quoted only when
it is a symbol? Something like this:
(foo 10) => 10
(foo hello) => ‘hello
(foo (lambda (x) (* 2 x))) =>
etc.
Kevin
--
You received this message because you are subscribed to the Google Groups
"Racket Users
2 matches
Mail list logo