------ CallClojure.java ------
import clojure.lang.RT;
import clojure.lang.Var;
import clojure.lang.PersistentVector;
public class CallClojure {
static PersistentVector toVec(int[][] arr) {
PersistentVector pv = PersistentVector.EMPTY;
for (int[] a : arr) {
PersistentVector temp = PersistentVector.EMPTY;
for (int n : a) {
temp = temp.cons(n);
}
pv = pv.cons(temp);
}
return pv;
}
public static void main(String[] args) throws Exception {
RT.loadResourceScript("foo.clj");
Var gimmie_vec = RT.var("foo", "gimmie-vec");
int[][] ar = {{1, 2}, {3, 4}, {5, 6}};
Object result = gimmie_vec.invoke(toVec(ar));
System.out.println(result);
}
}
------ foo.clj ------
(ns foo)
(defn gimmie-vec [v]
(println "class:" (class v))
(println "v:" v))
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en