Liking cljdoc? Tell your friends :D

uncomplicate.commons.core

Core Uncomplicate functions useful across all projects.

Projects that use native libraries and FFI typically need to dispose resources properly. To make this uniform, the typical resource managers need to implement the Releaseable protocol. Clients can then use the following functions to manage resources: [[release]] releaseable?, with-release, let-release.

It is often the case that you need an access to a mutable resource, but you want to protect the object's resource from destruction. For such cases (and other cases when this might be useful) there is a Viewable protocol. The [[view]] function should return a 'portal' to the object whose [[release]] implementation does nothing to the underlying resource.

For cases where you'd like to have the ability to inspect an object for various internal detail, but don't want to clutter its interface with many additional functions not related to the domain itself, implement the Info protocol. The [[info]] method returns a hash-map of all available information, or, if provided with a key, only the specific property related to that key.

Objects that manage data of certain size can implement protocols Entries and Bytes. Use the following functions to query for the data properties: size, sizeof, and bytesize.

The following functions might be useful from time to time when dealing with primitive types.

types, double-fn, long-fn, wrap-byte wrap-short wrap-int wrap-longwrap-floatwrap-double, Mappable, [[map]], [[unmap]].

Please refer to the tests folder, and to the source of other Uncomplicate projects to see how the functions from this namespace can be useful in various ways.

Core Uncomplicate functions useful across all projects.

Projects that use native libraries and FFI typically need to dispose resources properly.
To make this uniform, the typical resource managers need to implement the [[Releaseable]]
protocol. Clients can then use the following functions to manage resources:
[[release]] [[releaseable?]], [[with-release]], [[let-release]].

It is often the case that you need an access to a mutable resource, but you want to
protect the object's resource from destruction. For such cases (and other cases
when this might be useful) there is a [[Viewable]] protocol. The [[view]] function
should return a 'portal' to the object whose [[release]] implementation does nothing
to the underlying resource.

For cases where you'd like to have the ability to inspect an object for various
internal detail, but don't want to clutter its interface with many additional
functions not related to the domain itself, implement the [[Info]] protocol.
The [[info]] method returns a hash-map of all available information, or, if provided
with a key, only the specific property related to that key.

Objects that manage data of certain size can implement protocols [[Entries]] and [[Bytes]].
Use the following functions to query for the data properties: [[size]], [[sizeof]], and [[bytesize]].

The following functions might be useful from time to time when dealing with primitive types.

[[types]], [[double-fn]], [[long-fn]],
[[wrap-byte]] [[wrap-short]] [[wrap-int]] [[wrap-long]][[wrap-float]][[wrap-double]],
[[Mappable]], [[map]], [[unmap]].

Please refer to the tests folder, and to the source of other Uncomplicate projects to
see how the functions from this namespace can be useful in various ways.
raw docstring

Bytescljprotocol

Object that has size in bytes.

Object that has size in bytes.

bytesize*clj

(bytesize* this)

The size of this object's data in bytes.

The size of this object's data in bytes.
sourceraw docstring

bytesizeclj

(bytesize x)

The size of x's data in bytes.

The size of `x`'s data in bytes.
sourceraw docstring

double-fncljmacro

(double-fn f)

Wraps a function into a primitive type-annotated function (to satisfy the compiler in some cases).

Wraps a function into a primitive type-annotated function (to satisfy the compiler in some cases).
sourceraw docstring

Entriescljprotocol

Object that holds data that has total size in number of entries and size of one entry in bytes.

Object that holds data that has total size in number of entries and size of one entry in bytes.

size*clj

(size* this)

Number of entries in data.

Number of entries in data.

sizeof*clj

(sizeof* entry)

Size of one data entry in bytes.

Size of one data entry in bytes.
sourceraw docstring

Infocljprotocol

Object that can provide detailed information maps.

Object that can provide detailed information maps.

infoclj

(info this)
(info this info-type)

Provide all available information, or, spicific information if the corresponding info-type key is provided.

Provide all available information, or, spicific information if the corresponding `info-type` key is provided.
sourceraw docstring

let-releasecljmacro

(let-release bindings & body)

Binds Releasable elements to symbols (like let does), evaluates body, and, if any exception occures, releases the resources held by the bindings. The bindings can also be deeply sequential (see examples) - they should be released properly.

Example:

(let-release [devs (devices (first (platforms)))
              dev (first devs)
              ctx (context devs)
              queue (command-queue ctx dev)]
  (info dev)
  (info queue))
Binds Releasable elements to symbols (like `let` does), evaluates `body`,  and, if any exception
occures, releases the resources held by the bindings. The bindings can also be deeply sequential
(see examples) - they should be released properly.

Example:

    (let-release [devs (devices (first (platforms)))
                  dev (first devs)
                  ctx (context devs)
                  queue (command-queue ctx dev)]
      (info dev)
      (info queue))
sourceraw docstring

long-fncljmacro

(long-fn f)

Wraps a function into a primitive type-annotated function (to satisfy the compiler in some cases).

Wraps a function into a primitive type-annotated function (to satisfy the compiler in some cases).
sourceraw docstring

Mappablecljprotocol

Objects whose memory can be mapped or unmapped.

Objects whose memory can be mapped or unmapped.

mmapclj

(mmap this)
(mmap this flags)

Map this object.

Map this object.

unmapclj

(unmap this mapped)

Unmap this object.

Unmap this object.
sourceraw docstring

Releaseablecljprotocol

Objects that hold resources that can be released after use. For OpenCL objects, releasing means decrementing the reference count of the object. Pointers call JavaCPP deallocators, Vectors and matrices call free!, etc. The errors should be signalled by throwing an exception rather than by the return value.

Objects that hold resources that can be released after use. For OpenCL
objects, releasing means decrementing the reference count of the object.
Pointers call JavaCPP deallocators, Vectors and matrices call `free!`, etc.
The errors should be signalled by throwing an exception rather than
by the return value.

releaseclj

(release this)

Releases all resources held by this object.

Releases all resources held by this object.
sourceraw docstring

releaseable?clj

(releaseable? this)

Checks whether this is releaseable (in terms of Releaseable protocol).

Checks whether this is releaseable (in terms of Releaseable protocol).
sourceraw docstring

sizeclj

(size x)

The size of x's data in number of entries.

The size of `x`'s data in number of entries.
sourceraw docstring

sizeofclj

(sizeof x)

The size of one data entry of x's data in bytes.

The size of one data entry of `x`'s data in bytes.
sourceraw docstring

typesclj

Available mappings from keywords to Java primitive types.

Available mappings from keywords to Java primitive types.
sourceraw docstring

Viewablecljprotocol

Attach a default dense structure to the raw data of x. x can be anything that implements Viewable, such as DirectByteBuffer, Pointer, vector, matrix, tensor, Java object etc. The default implementation just returns the object itself. Changes to the resulting object can affect the source x, even the parts of data that might not be accessible by x. Use with caution! Typically creates a new instance that reuses the master's data, but releasing a view should never release the master data. Many code examples are available throughout Uncomplicate libraries.

Attach a default dense structure to the raw data of `x`. `x` can be anything that implements
Viewable, such as `DirectByteBuffer`, `Pointer`, vector, matrix, tensor, Java object etc.
The default implementation just returns the object itself.
Changes to the resulting object can affect the source `x`, even the parts of data that might not
be accessible by `x`. Use with caution!
Typically creates a new instance that reuses the master's data, but releasing a view should
never release the master data.
Many code examples are available throughout Uncomplicate libraries.

viewclj

(view this)

Views this through new managing instance.

Views this through new managing instance.
sourceraw docstring

with-releasecljmacro

(with-release bindings & body)

Binds Releasable elements to symbols (like let does), evaluates body, and eventually releases the resources held by the bindings. The bindings can also be deeply sequential (see examples) - they should be released properly.

Example:

(with-release [devs (devices (first (platforms)))
               dev (first devs)
               ctx (context devs)
               queue (command-queue ctx dev)]
  (info dev)
  (info queue))
Binds Releasable elements to symbols (like `let` does), evaluates `body`,
and eventually releases the resources held by the bindings. The bindings can also
be deeply sequential (see examples) - they should be released properly.

Example:

    (with-release [devs (devices (first (platforms)))
                   dev (first devs)
                   ctx (context devs)
                   queue (command-queue ctx dev)]
      (info dev)
      (info queue))
sourceraw docstring

wrap-byteclj

(wrap-byte x)

Wraps a long number with a primitive byte array

Wraps a long number with a primitive byte array
sourceraw docstring

wrap-doubleclj

(wrap-double x)

Wraps a double number with a primitive double array

Wraps a double number with a primitive double array
sourceraw docstring

wrap-floatclj

(wrap-float x)

Wraps a double number with a primitive float array

Wraps a double number with a primitive float array
sourceraw docstring

wrap-intclj

(wrap-int x)

Wraps a long number with a primitive int array

Wraps a long number with a primitive int array
sourceraw docstring

wrap-longclj

(wrap-long x)

Wraps a long number with a primitive long array

Wraps a long number with a primitive long array
sourceraw docstring

wrap-shortclj

(wrap-short x)

Wraps a long number with a primitive short array

Wraps a long number with a primitive short array
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close