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 9:17 PM Kevin Forchione <lyss...@gmail.com> wrote:

> 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))) => <procedure>
> etc.
>
> 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.
> For more options, visit https://groups.google.com/d/optout.
>

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