Liking cljdoc? Tell your friends :D

flatland.useful.utils


Adjoincljprotocol

adjoin-ontoclj

(adjoin-onto left right)

Merge two data structures by combining the contents. For maps, merge recursively by adjoining values with the same key. For collections, combine the right and left using into or conj. If the left value is a set and the right value is a map, the right value is assumed to be an existence map where the value determines whether the key is in the merged set. This makes sets unique from other collections because items can be deleted from them.

Merge two data structures by combining the contents. For maps, merge recursively by
adjoining values with the same key. For collections, combine the right and left using
into or conj. If the left value is a set and the right value is a map, the right value
is assumed to be an existence map where the value determines whether the key is in the
merged set. This makes sets unique from other collections because items can be deleted
from them.
source

adjoinclj

(adjoin a b)

Merge two data structures by combining the contents. For maps, merge recursively by adjoining values with the same key. For collections, combine the right and left using into or conj. If the left value is a set and the right value is a map, the right value is assumed to be an existence map where the value determines whether the key is in the merged set. This makes sets unique from other collections because items can be deleted from them.

Merge two data structures by combining the contents. For maps, merge recursively by
adjoining values with the same key. For collections, combine the right and left using
into or conj. If the left value is a set and the right value is a map, the right value
is assumed to be an existence map where the value determines whether the key is in the
merged set. This makes sets unique from other collections because items can be deleted
from them.
sourceraw docstring

copy-metaclj

(copy-meta dest src)

Copy all the metadata from src to dest.

Copy all the metadata from src to dest.
sourceraw docstring

defmcljmacro

(defm & defn-args)

Define a function with memoization. Takes the same arguments as defn.

Define a function with memoization. Takes the same arguments as defn.
sourceraw docstring

empty-coll?clj

(empty-coll? x)

Is x a collection and also empty?

Is x a collection and also empty?
sourceraw docstring

failclj

(fail exception)
(fail string & args)

Raise an exception. Takes an exception or a string with format args.

Raise an exception. Takes an exception or a string with format args.
sourceraw docstring

if-nscljmacro

(if-ns ns-reference then-form & [else-form])

Try to load a namespace reference. If successful, evaluate then-form otherwise evaluate else-form.

Try to load a namespace reference. If successful, evaluate then-form otherwise evaluate else-form.
sourceraw docstring

into-setclj

(into-set set map)

Update the given set using an existence map.

Update the given set using an existence map.
sourceraw docstring

invokeclj

(invoke f)
(invoke f x)
(invoke f x & more)

Like clojure.core/apply, but doesn't expand/splice the last argument.

Like clojure.core/apply, but doesn't expand/splice the last argument.
sourceraw docstring

let-latercljmacro

(let-later bindings & body)

Behaves like let, but bindings which have :delay metadata on them are evaluated lazily, by placing their values in a delay and forcing the delay whenever the body of the let-later needs the value. For example,

(let-later [^:delay a (do-stuff)] (when (whatever) a))

will only evaluate (do-stuff) if (whatever) is true.

Behaves like let, but bindings which have :delay metadata on them are
evaluated lazily, by placing their values in a delay and forcing the
delay whenever the body of the let-later needs the value. For example,

(let-later [^:delay a (do-stuff)]
  (when (whatever) a))

will only evaluate (do-stuff) if (whatever) is true.
sourceraw docstring

map-entrycljmacro

(map-entry a b)

Create a clojure.lang.MapEntry from a and b. Equivalent to a cons cell. flatland.useful.experimental.unicode contains a shortcut to this, named ·.

Create a clojure.lang.MapEntry from a and b. Equivalent to a cons cell.
flatland.useful.experimental.unicode contains a shortcut to this, named ·.
sourceraw docstring

memoize-derefclj

(memoize-deref vars f)

Returns a memoized version a non-referentially transparent function, calling deref on each provided var (or ref or atom) and using that in the cache key to prevent cross-contamination if any of the values change.

Returns a memoized version a non-referentially transparent function, calling deref on each
provided var (or ref or atom) and using that in the cache key to prevent cross-contamination if
any of the values change.
sourceraw docstring

or-maxclj

(or-max & args)

The maximium value of vals, ignoring nils.

The maximium value of vals, ignoring nils.
sourceraw docstring

or-minclj

(or-min & args)

The minimium value of vals, ignoring nils.

The minimium value of vals, ignoring nils.
sourceraw docstring

pairclj

(pair a b)

Create a clojure.lang.MapEntry from a and b. Equivalent to a cons cell

Create a clojure.lang.MapEntry from a and b. Equivalent to a cons cell
sourceraw docstring

pop-ifclj

(pop-if stack pred? & [default])

Pop item off the given stack if (pred? item) returns true, returning both the item and the modified stack. If (pred? item) is false, return nil or the optional default value.

Pop item off the given stack if (pred? item) returns true, returning both the item and the
modified stack. If (pred? item) is false, return nil or the optional default value.
sourceraw docstring

queueclj

(queue)
(queue seq)

Create an empty persistent queue or a persistent queue from a sequence.

Create an empty persistent queue or a persistent queue from a sequence.
sourceraw docstring

read-seqclj

(read-seq)

Read all forms from in until an EOF is reached. Throws an exception on incomplete forms.

Read all forms from *in* until an EOF is reached. Throws an exception on incomplete forms.
sourceraw docstring

returningcljmacro

(returning value & forms)

Compute a return value, then execute other forms for side effects. Like prog1 in common lisp, or a (do) that returns the first form.

Compute a return value, then execute other forms for side effects.
Like prog1 in common lisp, or a (do) that returns the first form.
sourceraw docstring

split-vecclj

(split-vec v & ns)

Split the given vector at the provided offsets using subvec. Supports negative offsets.

Split the given vector at the provided offsets using subvec. Supports negative offsets.
sourceraw docstring

switchcljmacro

(switch expr & clauses)

Like case, but uses object equality instead of the compile-time hash. Also, switch does not require a default clause. Of course, switch is not as efficient as case, but it works for things like functions, which case cannot support.

Like case, but uses object equality instead of the compile-time hash. Also, switch does not
require a default clause. Of course, switch is not as efficient as case, but it works for things
like functions, which case cannot support.
sourceraw docstring

syntax-quoteclj

(syntax-quote form)

Syntax quote the given form, wrapping all seqs and symbols in quote.

Syntax quote the given form, wrapping all seqs and symbols in quote.
sourceraw docstring

thread-localcljmacro

(thread-local & body)

Takes a body of expressions, and returns a java.lang.ThreadLocal object. (see http://download.oracle.com/javase/6/docs/api/java/lang/ThreadLocal.html).

To get the current value of the thread-local binding, you must deref (@) the thread-local object. The body of expressions will be executed once per thread and future derefs will be cached.

Note that while nothing is preventing you from passing these objects around to other threads (once you deref the thread-local, the resulting object knows nothing about threads), you will of course lose some of the benefit of having thread-local objects.

Takes a body of expressions, and returns a java.lang.ThreadLocal object.
(see http://download.oracle.com/javase/6/docs/api/java/lang/ThreadLocal.html).

To get the current value of the thread-local binding, you must deref (@) the
thread-local object. The body of expressions will be executed once per thread
and future derefs will be cached.

Note that while nothing is preventing you from passing these objects around
to other threads (once you deref the thread-local, the resulting object knows
nothing about threads), you will of course lose some of the benefit of having
thread-local objects.
sourceraw docstring

thread-local*clj

(thread-local* init)

Non-macro version of thread-local - see documentation for same.

Non-macro version of thread-local - see documentation for same.
sourceraw docstring

update-peekclj

(update-peek stack f & args)

Update the element in stack that would be returned by peek, returning a new stack.

Update the element in stack that would be returned by peek, returning a new stack.
sourceraw docstring

verifycljmacro

(verify test & args)

Raise exception unless test returns true.

Raise exception unless test returns true.
sourceraw docstring

with-adjustmentscljmacro

(with-adjustments adjustment bindings & body)

Create new bindings for binding args, by applying adjustment function to current values of bindings.

Create new bindings for binding args, by applying adjustment
function to current values of bindings.
sourceraw docstring

with-timingcljmacro

(with-timing & body)

Same as clojure.core/time but returns a vector of the result of the code and the milliseconds rather than printing a string. Runs the code in an implicit do.

Same as clojure.core/time but returns a vector of the result of
the code and the milliseconds rather than printing a string. Runs
the code in an implicit do.
sourceraw docstring

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

× close