简体   繁体   中英

No such var: clojure.core/def

When I try to run this code in 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).

def isn't used inside an ns declaration (ns is a macro, btw). try this instead:

(ns cl1)

(def s 1)
(println s)

http://clojure.org/namespaces

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM