Re: quoting vs syntax quoting

2020-03-02 Thread Alan Thompson
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

Re: quoting vs syntax quoting

2020-03-02 Thread Rutvik Patel
> 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

Re: quoting vs syntax quoting

2020-03-02 Thread Anatoly Smolyaninov
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 [])) > >

quoting vs syntax quoting

2020-03-02 Thread Sonny To
(defmacro moo1 [] '(defn foo [])) (defmacro moo2 [] `(defn foo [])) stigmergy.wocket.server> (moo1)