File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 1
1
(ns libpython-clj2.java-api
2
+ " A java api is exposed for libpython-clj2. The methods below are statically callable without the leading '-'.
3
+ Note that returned python objects implement the respective java interfaces so a python dict will implement
4
+ java.util.Map, etc. There is some startup time as Clojure dynamically compiles the source code but
5
+ this binding should have great runtime characteristics in comparison to any other java python engine.
6
+
7
+ ```java
8
+ import libpython_clj2.java_api;
9
+
10
+
11
+
12
+ java_api.initialize(null);
13
+ np = java_api.importModule(\" numpy\" );
14
+ clojure.lang.IFn ones = (clojure.lang.IFn)java_api.getAttr(np, \" ones\" );
15
+ ArrayList dims = new ArrayList();
16
+ dims.add(2);
17
+ dims.add(3);
18
+ Object npArray = ones.invoke(dims);
19
+
20
+ ```"
2
21
(:import [java.util Map Map$Entry]
3
22
[java.util.function Supplier]
4
23
[clojure.java.api Clojure])
You can’t perform that action at this time.
0 commit comments