importclojureclasspathjvm-argumentsclojure-contrib

loading clojure-contrib


I'm new to the whole JVM thing, and trying to play with clojure. I'm attempting to load clojure-contrib and failing:

# in bash
$ java -cp /path/to/clojure.jar:/path/to/contrib.jar clojure.main

# in REPL
user=> (require 'clojure.contrib.math)
nil
user=> (sqrt 2)
java.lang.Exception: Unable to resolve symbol: sqrt in this context (NO_SOURCE_FILE:10)

Any pointers will be great - thanks.


Solution

  • I'm no expert, but it seemed like a namespace issue. The solution I employed was this:

    ;; for REPL
    user=> (ns user (:use clojure.contrib.math))
    nil
    user=> (sqrt 2)
    1.4142135623730951