In common lisp I can do this:
src-> (defmacro macro-hello () `"hello")
(eval '(macro-hello))
no problem.
In clojure:
(defmacro macro-hello [] `"hello")
(eval '(macro-hello))
gives me an error. Have I done something wrong?
Clojure Error:
Exception in thread "main" java.lang.Exception: Unable to resolve symbol: macro-hello in this context (NO_SOURCE_FILE:12) at clojure.lang.Compiler.analyze(Compiler.java:4340) at clojure.lang.Compiler.analyze(Compiler.java:4286) at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:2767) at clojure.lang.Compiler.analyzeSeq(Compiler.java:4498) at clojure.lang.Compiler.analyze(Compiler.java:4325) at clojure.lang.Compiler.analyze(Compiler.java:4286) at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:3862) at clojure.lang.Compiler$FnMethod.parse(Compiler.java:3697) at clojure.lang.Compiler$FnMethod.access$1100(Compiler.java:3574) at clojure.lang.Compiler$FnExpr.parse(Compiler.java:2963) at clojure.lang.Compiler.analyzeSeq(Compiler.java:4494) at clojure.lang.Compiler.analyze(Compiler.java:4325) at clojure.lang.Compiler.eval(Compiler.java:4530) at clojure.core$eval__3990.invoke(core.clj:1728) at com.yourcompany.defpackage$_main__4.invoke(defpackage.clj:12) at clojure.lang.AFn.applyToHelper(AFn.java:171) at clojure.lang.AFn.applyTo(AFn.java:164) at com.yourcompany.defpackage.main(Unknown Source) Caused by: java.lang.Exception: Unable to resolve symbol: macro-hello in this context at clojure.lang.Compiler.resolveIn(Compiler.java:4682) at clojure.lang.Compiler.resolve(Compiler.java:4628) at clojure.lang.Compiler.analyzeSymbol(Compiler.java:4605) at clojure.lang.Compiler.analyze(Compiler.java:4307) ... 17 more Java Result: 1
[Edited]: added ending double quote