(->jvm item & [options])Copy an object into the jvm (if it wasn't there already.)
Copy an object into the jvm (if it wasn't there already.)
(->py-fn fn-obj)(->py-fn fn-obj
{:keys [method-name documentation py-self]
:or {method-name "unnamed_function" documentation "not documented"}})Create a python callback from a clojure fn. If clojure fn, then tuple arguments are used. If keyword arguments are desired, the pass in something derived from: libpython-clj.jna.CFunction$KeyWordFunction. If a pure fn is passed in, arguments are marshalled from python if possible and then to-python in the case of successful execution. An exception will set the error indicator.
Create a python callback from a clojure fn. If clojure fn, then tuple arguments are used. If keyword arguments are desired, the pass in something derived from: libpython-clj.jna.CFunction$KeyWordFunction. If a pure fn is passed in, arguments are marshalled from python if possible and then to-python in the case of successful execution. An exception will set the error indicator.
(->python item & [options])Completely convert a jvm object to a python copy.
Completely convert a jvm object to a python copy.
(add-module modname)Add a python module. Returns a bridge
Add a python module. Returns a bridge
(as-jvm item & [options])Bridge a python object into the jvm. Attempts to build a jvm bridge that 'hides' the python type. This bridge is lazy and noncaching so use it wisely; it may be better to just copy the type once into the JVM. Bridging is recursive so any subtypes are also bridged if possible or represented by a hashmap of {:type :value} if not.
Bridge a python object into the jvm. Attempts to build a jvm bridge that 'hides' the
python type. This bridge is lazy and noncaching so use it wisely; it may be better to
just copy the type once into the JVM. Bridging is recursive so any subtypes are also
bridged if possible or represented by a hashmap of {:type :value} if not.(as-list item)Return a List implementation using getitem, setitem.
Return a List implementation using __getitem__, __setitem__.
(as-map item)Return a Map implementation using getitem, setitem. Note that it may be incomplete especially if the object has no 'keys' attribute.
Return a Map implementation using __getitem__, __setitem__. Note that it may be incomplete especially if the object has no 'keys' attribute.
(as-python item & [options])Bridge a jvm object into python
Bridge a jvm object into python
(as-tensor item)Return a tech.v2.tensor object from the item that shares the data backing store.
Return a tech.v2.tensor object from the item that shares the data backing store.
(att-type-map item)Get hashmap of att name to keyword datatype.
Get hashmap of att name to keyword datatype.
(call-attr item att-name & args)Call an object attribute
Call an object attribute
(dir item)Get sorted list of all attribute names.
Get sorted list of all attribute names.
(import-module modname)Import a python module. Returns a bridge
Import a python module. Returns a bridge
(module-dict module)Get the module dictionary. Returns bridge.
Get the module dictionary. Returns bridge.
(run-simple-string program & {:keys [globals locals]})Run a simple string returning boolean 1 or 0. Implemented in cpython as:
PyObject *m, *d, *v; m = PyImport_AddModule("main"); if (m == NULL) return -1; d = PyModule_GetDict(m); v = PyRun_StringFlags(command, Py_file_input, d, d, flags); if (v == NULL) { PyErr_Print(); return -1; } Py_DECREF(v); return 0;
Run a simple string returning boolean 1 or 0.
Implemented in cpython as:
PyObject *m, *d, *v;
m = PyImport_AddModule("__main__");
if (m == NULL)
return -1;
d = PyModule_GetDict(m);
v = PyRun_StringFlags(command, Py_file_input, d, d, flags);
if (v == NULL) {
PyErr_Print();
return -1;
}
Py_DECREF(v);
return 0;(run-string program & {:keys [globals locals]})If you don't know what you are doing, this will sink you. See documentation for run-simple-string.
If you don't know what you are doing, this will sink you. See documentation for run-simple-string.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |