Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No such var: clojure.core/def

Tags:

clojure

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).

like image 646
Jon Bristow Avatar asked Jun 22 '10 19:06

Jon Bristow


1 Answers

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

like image 124
Joshua Smith Avatar answered Sep 23 '22 10:09

Joshua Smith