I am very new to both Clojure and Leiningen. I have installed Clojure on Windows at C:\clojure-1.5.1
and leiningen-win-installer beta1 at C:\.lein\bin
.
Now I am trying the example from Eric Rochester's book. I have included dependent libraries for Incanter in project.clj and also using dep.
How do I use the command (use 'incanter.core)
? I am getting 'use' is not recognized as an internal or external command
. In addition, how do I use lein commands at user=>
?
Edit - I forgot "lein deps" until I saw Mars's answer
Before you start lein repl, you have to make the project (with "lein new getting-data" or whatever is in the book).
That makes a new directory, and in that directory you find and edit "project.clj" to include the dependencies (as shown in book).
cd into the directory that project.clj is in and run "lein deps" from the dos/powershell prompt.
THEN when you run lein repl, from within that same directory, at the user=> prompt, do
(use 'incanter.core)
and it will come back with "nil" and you'll be running. You might want to first run some examples from the leiningen page to get more of a feel for lein. You always type clojure commands at the "user=>" prompt, not at the "c:....>" prompt.
There's a bit of subtlety in Leiningen project.clj's. I haven't found an easy introduction. Levin Magruder's advice will no doubt get you started. The basic idea is that once the project file is set up correctly, lein deps
will go out and find the libraries you need, and put them in a place where lein repl
can find them. Then use
will work for the libraries that have been downloaded. For more info, study of the detailed comments project.clj sample file may be helpful. (Not part of the answer to this question, but if you're having problems with use
, you're likely to get tripped up by ns
and filenames soon (I was): I recommend Colin Jones' introduction to ns
and its options.)