Assuming the Java or Clojure library is on your classpath, it *should* be
usable from the REPL.

(import '[java.library SomeClass])

(.foo (SomeClass. 42))

(require '[clojure.contrib.math :as m])

(m/sqrt 42.0)

or whatever.

(Didn't this exact question just get asked by someone five minutes ago?
Even looking for the same math function.)



On Thu, Nov 7, 2013 at 8:18 AM, Starry SHI <starr...@gmail.com> wrote:

> Hi, I am new to clojure and I find lein REPL very convenient to use. But I
> have one question: in REPL, how to include functions defined in other
> libraries and call them in my clojure code?
>
> For example, my code need to call square root function defined in
> clojure.contrib.math (included in clojure-contrib.jar). Can anyone tell me
> how to include this jar file from lein repl, so that my code can call sqrt
> function?
>
> Thank you!
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to