Reputation: 8431
I'm going through the Joy of Clojure book and ran into the following series of errors in Ch. 2:
(def make-list0 #(list))
=> (var cursive-test.core/make-list0)
(make-list0)
IllegalStateException Attempting to call unbound fn: #'cursive-test.core/list clojure.lang.Var$Unbound.throwArity (Var.java:43)
(def make-list2 #(list %1 %2))
=> (var cursive-test.core/make-list2)
(make-list2 1 2)
IllegalStateException Attempting to call unbound fn: #'cursive-test.core/list clojure.lang.Var$Unbound.throwArity (Var.java:43)
(def make-list2+ #(list %1 %2 %&))
=> (var cursive-test.core/make-list2+)
(make-list2+ 1 2 3 4 5)
IllegalStateException Attempting to call unbound fn: #'cursive-test.core/list clojure.lang.Var$Unbound.throwArity (Var.java:43)
I'm not sure what is going on here. I'm using IntelliJ IDEA with the Cursive plugin. Any ideas?
Upvotes: 2
Views: 105
Reputation: 91857
Somehow you accidentally defined something called list
in your own namespace, but didn't give it a value. One way you could accidentally do this would be to use a def
inside a function, but never actually call that function:
(defn foo [x]
(def list x))
The solution is to not do that, and the easiest way to get back to normalcy is to restart your repl and reload the namespace once it no longer has this incorrect redefinition of list
in it. If you can't find where you've defined it, note that reloading the namespace should also print a warning message telling you you're redefining list
, which I think includes a line number, but I don't recall for sure.
Upvotes: 2