Search code examples
intellij-ideaclojurela-clojure

Simple clojure/refer to clojure throwing compilation error


I'm new to Clojure development and I was following Eric Rochester tutorials on the subject, most precisily: Tokenization Part 4

When namespaces are introduced Eric asks the users to write this header on a file named word.clj as I did:

(in-ns 'word)
(clojure/refer 'clojure)

And using La Clojure plugin for intellij IDEA I launch a Clojure REPL and get this:

Clojure 1.5.1
user=> (load-file "C:/folder/Dev/src/clojure/src/word.clj")
CompilerException java.lang.RuntimeException: No such namespace: clojure, compiling:(C:\folder\Dev\src\clojure\src\word.clj:2:1) 

For such a simple two line program I wouldn't expect these to be missing dependencies, especially when I'm referring the closure core library.

Can someone explain what kind of noob mistake I'm doing?

Thank you.


Solution

  • Namespace clojure is obsolete (that blog is quite old, 2008). Use clojure.core:

    user> (in-ns 'word)
    ;; => #<Namespace word>
    user> (clojure.core/refer 'clojure.core)
    ;; => nil