Skip to content

Commit 39337a8

Browse files
committed
Updating namespace docs for the java api.
1 parent f8a4dcd commit 39337a8

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/libpython_clj2/java_api.clj

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,23 @@
11
(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+
```"
221
(:import [java.util Map Map$Entry]
322
[java.util.function Supplier]
423
[clojure.java.api Clojure])

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy