(defmacro moo1 []
'(defn foo []))
(defmacro moo2 []
`(defn foo []))
stigmergy.wocket.server> (moo1)
#'stigmergy.wocket.server/foo
stigmergy.wocket.server> (moo2)
CompilerException clojure.lang.ExceptionInfo: Call to clojure.core/defn did
not conform to spec:
In: [0] val: stigmergy.wocket.server/foo fails spec:
:clojure.core.specs.alpha/defn-args at: [:args :name] predicat\
e: simple-symbol?
#:clojure.spec.alpha{:problems [{:path [:args :name], :pred
clojure.core/simple-symbol?, :val stigmergy.wocket.ser\
ver/foo, :via [:clojure.core.specs.alpha/defn-args
:clojure.core.specs.alpha/defn-args], :in [0]}], :spec #object[c\
lojure.spec.alpha$regex_spec_impl$reify__2436 0x33d84248
"clojure.spec.alpha$regex_spec_impl$reify__2436@33d84248"]\
, :value (stigmergy.wocket.server/foo []), :args
(stigmergy.wocket.server/foo [])}, compiling:(*cider-repl workspac\
e/clj-collage:localhost:39319(clj)*:131:26)
stigmergy.wocket.server> (macroexpand-1 '(moo1))
(defn foo [])
stigmergy.wocket.server> (macroexpand-1 '(moo2))
(clojure.core/defn stigmergy.wocket.server/foo [])
moo1 uses normal quoting while moo2 uses syntax quoting. Why does (moo1)
succeeds but( moo2) fails? Both seem to evaluate to same data-structure
except moo2 has namespaces.
The error message is cryptic but it seems moo2 is failing on
clojure.core/simple-symbol?
which seems like a symbol without a namespace. How can I make a symbol
without a namespace in syntax quoting?
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/clojure/8d7b6fc7-5dcc-45fd-a19b-b424b295a27f%40googlegroups.com.