It is even simpler if you just run the following code:
(println "plain-quote: " 'map)
(println "syntax-quote: " `map)
with result:
plain-quote:map
syntax-quote: clojure.core/map
The syntax-quote also allows you to unquote forms using `~` and `~@` (you
can't do this with plain-quote).
> How can I make a symbol without a namespace in syntax quoting?
You need quote + unquote.
user=> (defmacro moo2 [] `(defn ~'foo []))
#'user/moo2
user=> (macroexpand-1 '(moo2))
(clojure.core/defn foo [])
user=> (moo2)
#'user/foo
Focus on *~'foo *thing, we first *quote* the foo and *unquote* is us
Yes, backtick is hygienic, i.e. it adds ns to symbols. you can define name
first and inject:
```
(defmacro moo2 []
(let [name (symbol "foo")]
`(defn ~name [])))
```
понедельник, 2 марта 2020 г., 10:54:51 UTC+1 пользователь Sonny To написал:
>
> (defmacro moo1 []
> '(defn foo []))
>
> (