Tutorial :Troubles Importing Clojure Libs in Paradise



Question:

I occasionally get this problem, and generally work around it, but it's rather frustrating.

I have all of Incanter (check it out if you don't know it: it's superb) on my classpath. I try to import it (through a Slime REPL) like this: user> (use 'incanter.core), but fail.

Doing this: user> (use 'clojure.contrib.def) works just fine, and this file is in the same placeâ€"on my classpath.

Regardless, the error isn't anything about classpath: it's this:

Don't know how to create ISeq from: clojure.lang.Symbol    [Thrown class java.lang.IllegalArgumentException]   

You can see my entire terminal here (a screenshot.)

I don't know what's going on here, and it's really frustrating, as I really would like to use Incancter, and I can from the Incanter binary's REPL. I definitely don't want to develop from thatâ€"and this should work.

Any help would be much appreciated.

EDIT:

It appears as though Incanter requires Clojure 1.2, and lein swank gives me Clojure 1.1. This might be the cause of my problems: if so, is there a way to continue to use Swank & Lein with Clojure 1.2?

Thanks again!

EDIT:

Apparently if you start using Clojure-1.1 and lein swank, you're stuck with it unless you make a new project.

If future people have this problem, this article helped me out, but also, at least for me, you must start a new lein project if you had begun it using leink swank and Clojure-1.1. Simply changing your project.clj file and then lein swanking again doesn't work.


Solution:1

Yes, you can use Leiningen and swank-clojure with Clojure 1.2. You might need to use a recent version of Leiningen (I'm not sure if a certain old limitation affected lein repl only or was it lein swank as well; anyway, try the 1.2-RC2 which you'll find in the downloads section on GitHub). You will also need to use a recent-enough swank-clojure; I use a bleeding edge checkout myself, get yours here.

Other than that, simply use 1.2 jars for Clojure and contrib. (Lein uses it's own Clojure, separate from the one used for lein swank, for its internal workings and you never need to care about it; swank-clojure has no AOT'd namespaces and doesn't particularly care about the Clojure version, except once in a (long!) while something breaks, a patch is applied and joy is restored.)

I hope the above helps, but if it doesn't: your problem description is not entirely sufficient for me to get a clear picture of what is happening. Could you add information on what it means for "all of Incanter" to be on your classpath (do you mean the jars? sources? where do you get them? how do you set your classpath?). Without knowing this, it'll be hard to replicate your setup to try to track down the source of the problem. Of course if bumping some versions fixes things, please disregard my current confusion. ;-)


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »