[英]No such var: clojure.core/def
When I try to run this code in eclipse: 当我尝试在eclipse中运行此代码时:
(ns cl1
(def s 1)
(print s)
)
I get 我明白了
java.lang.Exception: No such var: clojure.core/def (clojure.clj:1)
I'm a complete clojure newbie, but I think that the above code should create the symbol s, and then print what s is equivalent to to the screen (1). 我是一个完整的clojure新手,但我认为上面的代码应该创建符号s,然后打印s相当于屏幕(1)。
def isn't used inside an ns declaration (ns is a macro, btw). 在ns声明中不使用def(ns是宏,顺便说一句)。 try this instead: 试试这个:
(ns cl1)
(def s 1)
(println s)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.