|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object clojure.java.api.Clojure
public class Clojure
The Clojure class provides a minimal interface to bootstrap Clojure access from other JVM languages. It provides:
IFn
interface.read
for reading data using
Clojure's edn readerTo lookup and call a Clojure function:
IFn plus = Clojure.var("clojure.core", "+"); plus.invoke(1, 2);
Functions in clojure.core
are automatically loaded. Other
namespaces can be loaded via require
:
IFn require = Clojure.var("clojure.core", "require"); require.invoke(Clojure.read("clojure.set"));
IFn
s can be passed to higher order functions, e.g. the
example below passes plus
to read
:
IFn map = Clojure.var("clojure.core", "map"); IFn inc = Clojure.var("clojure.core", "inc"); map.invoke(inc, Clojure.read("[1 2 3]"));
Method Summary | |
---|---|
static Object |
read(String s)
Read one object from the String s. |
static IFn |
var(Object qualifiedName)
Returns the var associated with qualifiedName. |
static IFn |
var(Object ns,
Object name)
Returns an IFn associated with the namespace and name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static IFn var(Object qualifiedName)
qualifiedName
- a String or clojure.lang.Symbol
public static IFn var(Object ns, Object name)
ns
- a String or clojure.lang.Symbolname
- a String or clojure.lang.Symbol
public static Object read(String s)
s
- a String
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |