Liking cljdoc? Tell your friends :D

useful


*pcollect-thread-num*clj


abortclj

(abort & message)

Print message then exit.

Print message then exit.
raw docstring

absorbcljmacro

(absorb val form)

Thread val through form if val is not nil.

Thread val through form if val is not nil.
raw docstring

adjoinclj

(adjoin 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.
raw docstring

allclj

(all & preds)

Takes a list of predicates and returns a new predicate that returns true if all do.

Takes a list of predicates and returns a new predicate that returns true if all do.
raw docstring

anyclj

(any & preds)

Takes a list of predicates and returns a new predicate that returns true if any do.

Takes a list of predicates and returns a new predicate that returns true if any do.
raw docstring

assoc-ifcljmacro

(assoc-if map test & kvs)

Create mapping from keys to values in map if test returns true.

Create mapping from keys to values in map if test returns true.
raw docstring

assoc-in!clj

(assoc-in! m [k & ks] v)

Associates a value in a nested associative structure, where ks is a sequence of keys and v is the new value and returns a new nested structure. The associative structure can have transients in it, but if any levels do not exist, non-transient hash-maps will be created.

Associates a value in a nested associative structure, where ks is a sequence of keys
and v is the new value and returns a new nested structure. The associative structure
can have transients in it, but if any levels do not exist, non-transient hash-maps will
be created.
raw docstring

assoc-orclj

(assoc-or map key val)
(assoc-or map key val & kvs)

Create mapping from each key to val in map only if existing val is nil.

Create mapping from each key to val in map only if existing val is nil.
raw docstring

comp-partialclj

(comp-partial & fns)

Like comp, except all args but the last are passed to every function with the last arg threaded through these partial functions. So, the rightmost fn is applied to all arguments. Each fn is then applied to the original args with the last arg replaced by the result of the previous fn.

Like comp, except all args but the last are passed to every function with the last arg threaded through
these partial functions. So, the rightmost fn is applied to all arguments. Each fn is then applied to the
original args with the last arg replaced by the result of the previous fn.
raw docstring

cond-letcljmacro

(cond-let test-binding then-form & more)

An implementation of cond-let that is as similar as possible to if-let. Takes multiple test-binding/then-form pairs and evalutes the form if the binding is true. Also supports :else in the place of test-binding and always evaluates the form in that case.

Example: (cond-let [b (bar 1 2 3)] (println :bar b) [f (foo 3 4 5)] (println :foo f) [b (baz 6 7 8)] (println :baz b) :else (println :no-luck))

An implementation of cond-let that is as similar as possible to if-let. Takes multiple
test-binding/then-form pairs and evalutes the form if the binding is true. Also supports
:else in the place of test-binding and always evaluates the form in that case.

Example:
(cond-let [b (bar 1 2 3)] (println :bar b)
          [f (foo 3 4 5)] (println :foo f)
          [b (baz 6 7 8)] (println :baz b)
          :else           (println :no-luck))
raw docstring

conj-setclj

(conj-set coll item)

Conj onto collection ensuring it is a set.

Conj onto collection ensuring it is a set.
raw docstring

conj-vecclj

(conj-vec coll item)

Conj onto collection ensuring it is a vector.

Conj onto collection ensuring it is a vector.
raw docstring

constructclj

(construct class & args)

Construct a new instance of class using reflection.

Construct a new instance of class using reflection.
raw docstring

crossclj

(cross & seqs)

Computes the cartesian-product of the provided seqs. In other words, compute the set of all possible combinations of ways you can choose one item from each seq.

Computes the cartesian-product of the provided seqs. In other words, compute the set of all
possible combinations of ways you can choose one item from each seq.
raw docstring

defmcljmacro

(defm name & fdecl)

extractclj

(extract pred coll)

Extracts the first item that matches pred from coll, returning a vector of that item followed by coll with the item removed.

Extracts the first item that matches pred from coll, returning a vector of that item
followed by coll with the item removed.
raw docstring

filter-keysclj

(filter-keys pred map)

Returns a map that only contains keys where (pred key) returns true.

Returns a map that only contains keys where (pred key) returns true.
raw docstring

filter-keys-by-valclj

(filter-keys-by-val pred map)

Returns all keys in map for which (pred value) returns true.

Returns all keys in map for which (pred value) returns true.
raw docstring

filter-valsclj

(filter-vals pred map)

Returns a map that only contains values where (pred value) returns true.

Returns a map that only contains values where (pred value) returns true.
raw docstring

find-firstclj

(find-first pred coll)

Returns the first item of coll where (pred item) returns logical true.

Returns the first item of coll where (pred item) returns logical true.
raw docstring

find-withclj

(find-with pred keys vals)

Returns the val corresponding to the first key where (pred key) returns true.

Returns the val corresponding to the first key where (pred key) returns true.
raw 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.
raw docstring

include?clj

(include? val coll)

Check if val exists in coll.

Check if val exists in coll.
raw docstring

index-byclj

(index-by f coll)

Returns a map from the result of calling f on each item in coll to that item.

Returns a map from the result of calling f on each item in coll to that item.
raw docstring

into-mapclj

(into-map & args)

Convert a list of heterogeneous args into a map. Args can be alternating keys and values, maps of keys to values or collections of alternating keys and values.

Convert a list of heterogeneous args into a map. Args can be alternating keys and values,
maps of keys to values or collections of alternating keys and values.
raw docstring

into-vecclj

(into-vec to-coll from-coll)

Returns a new vector consisting of to-coll with all of the items of from-coll conjoined.

Returns a new vector consisting of to-coll with all of the items of from-coll conjoined.
raw docstring

invoke-privateclj

(invoke-private instance method & params)

Invoke a private or protected Java method. Be very careful when using this! I take no responsibility for the trouble you get yourself into.

Invoke a private or protected Java method. Be very careful when using this!
I take no responsibility for the trouble you get yourself into.
raw docstring

lazy-crossclj

(lazy-cross & seqs)

Compute a lazy cartesian-product of the provided seqs. The provided seqs can be lazy or even infinite, and lazy-cross will consume all sequences equally, only consuming more of any sequence when all possible combinations at the current level have been exhausted. This can be thought of intuitively as a breadth-first search of the cartesian product set.

Compute a lazy cartesian-product of the provided seqs. The provided seqs can be lazy or even
infinite, and lazy-cross will consume all sequences equally, only consuming more of any sequence
when all possible combinations at the current level have been exhausted. This can be thought of
intuitively as a breadth-first search of the cartesian product set.
raw docstring

let-ifcljmacro

(let-if test bindings & forms)

Choose a set of bindings based on the result of a conditional test.

Example: (let-if (even? a) [b (bar 1 2 3) (baz 1 2 3) c (foo 1) (foo 3)] (println (combine b c)))

Choose a set of bindings based on the result of a conditional test.

Example:
(let-if (even? a)
        [b (bar 1 2 3) (baz 1 2 3)
         c (foo 1)     (foo 3)]
  (println (combine b c)))
raw docstring

map-reduceclj

(map-reduce map-fn reduce-fn coll)
(map-reduce map-fn reduce-fn reduce-val coll & [map-val])

Perform a map and a reduce over a collection in a single pass. Unlike map, this is not lazy. Returns the equivalent of [(vec (map map-fn coll)) (reduce reduce-fn val coll)].

Perform a map and a reduce over a collection in a single pass. Unlike map, this is not lazy.
Returns the equivalent of [(vec (map map-fn coll)) (reduce reduce-fn val coll)].
raw docstring

map-toclj

(map-to f coll)

Returns a map from each item in coll to f applied to that item.

Returns a map from each item in coll to f applied to that item.
raw docstring

map-valsclj

(map-vals f m)

Create a new map from m by calling function f on each value to get a new value.

Create a new map from m by calling function f on each value to get a new value.
raw docstring

map-vals-with-keysclj

(map-vals-with-keys f m)

Create a new map from m by calling function f on each key and value to get a new value.

Create a new map from m by calling function f on each key and value to get a new value.
raw 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.
raw docstring

merge-inclj

(merge-in left right)

Merge two nested maps.

Merge two nested maps.
raw docstring

on-shutdownclj

(on-shutdown f)

Execute the given function on jvm shutdown.

Execute the given function on jvm shutdown.
raw docstring

or-maxclj

(or-max & vals)

The maximum value of vals, ignoring nils.

The maximum value of vals, ignoring nils.
raw docstring

or-minclj

(or-min & vals)

The minimium value of vals, ignoring nils.

The minimium value of vals, ignoring nils.
raw docstring

parse-optsclj

(parse-opts)
(parse-opts args)
(parse-opts default args)

Parse command line args or the provided argument list. Returns a map of keys to vectors of repeated values. Named args begin with --keyname and are mapped to :keyname. Unnamed arguments are mapped to nil or default. Repeated named values can be specified by repeating a key or by using commas in the value. Single and double dashes are both supported though a single dash followed by word characters without internal dashes or an equal sign is assumed to be single character argument flags and are split accordingly.

Example: (parse-opts ["foo" "-vD" "bar" "-no-wrap" "-color=blue,green" "--style=baroque" "-color=red"]) => {:style ["baroque"], :color ["blue" "green" "red"], :no-wrap [""], :D [""], :v [""], nil ["foo" "bar"]}

Parse command line args or the provided argument list. Returns a map of keys to
vectors of repeated values. Named args begin with --keyname and are mapped to
:keyname. Unnamed arguments are mapped to nil or default. Repeated named values can be
specified by repeating a key or by using commas in the value. Single and double dashes
are both supported though a single dash followed by word characters without internal
dashes or an equal sign is assumed to be single character argument flags and are split
accordingly.

Example:
  (parse-opts ["foo" "-vD" "bar" "-no-wrap" "-color=blue,green" "--style=baroque" "-color=red"])
  => {:style ["baroque"], :color ["blue" "green" "red"], :no-wrap [""], :D [""], :v [""], nil ["foo" "bar"]}
raw docstring

pcollectclj

(pcollect f coll)
(pcollect wrap-fn f coll)

Like pmap but not lazy and more efficient for less computationally intensive functions because there is less coordination overhead. The collection is sliced among the available processors and f is applied to each sub-collection in parallel using map.

Like pmap but not lazy and more efficient for less computationally intensive functions
because there is less coordination overhead. The collection is sliced among the
available processors and f is applied to each sub-collection in parallel using map.
raw docstring

pluralizeclj

(pluralize num singular & [plural])

Return a pluralized phrase, appending an s to the singular form if no plural is provided. For example: (plural 5 "month") => "5 months" (plural 1 "month") => "1 month" (plural 1 "radius" "radii") => "1 radius" (plural 9 "radius" "radii") => "9 radii"

Return a pluralized phrase, appending an s to the singular form if no plural is provided.
For example:
  (plural 5 "month") => "5 months"
  (plural 1 "month") => "1 month"
  (plural 1 "radius" "radii") => "1 radius"
  (plural 9 "radius" "radii") => "9 radii"
raw docstring

positionclj

(position coll)

Returns a map from item to the position of its first occurance in coll.

Returns a map from item to the position of its first occurance in coll.
raw 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.
raw docstring

remove-keysclj

(remove-keys pred map)

Returns a map that only contains keys where (pred key) returns false.

Returns a map that only contains keys where (pred key) returns false.
raw docstring

remove-keys-by-valclj

(remove-keys-by-val pred map)

Returns all keys of map for which (pred value) returns false.

Returns all keys of map for which (pred value) returns false.
raw docstring

remove-valsclj

(remove-vals pred map)

Returns a map that only contains values where (pred value) returns false.

Returns a map that only contains values where (pred value) returns false.
raw docstring

rescuecljmacro

(rescue form error-form)

Evaluate form, returning error-form on any Exception.

Evaluate form, returning error-form on any Exception.
raw docstring

separateclj

(separate pred coll)

Split coll into two sequences, one that matches pred and one that doesn't. Unlike the version in clojure.contrib.seq-utils, pred is only called once per item.

Split coll into two sequences, one that matches pred and one that doesn't. Unlike the
version in clojure.contrib.seq-utils, pred is only called once per item.
raw docstring

sliceclj

(slice n coll)

Divide coll into n approximately equal slices.

Divide coll into n approximately equal slices.
raw 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.
raw 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.
raw docstring

tapclj

(tap f obj)

Call f on obj, presumably with side effects, then return obj. Useful for debugging when you want to print an object inline. e.g. (tap println foo)

Call f on obj, presumably with side effects, then return obj. Useful for debugging when
you want to print an object inline. e.g. (tap println foo)
raw docstring

thrushclj

(thrush & args)

Takes the first argument and applies the remaining arguments to it as functions from left to right. This tiny implementation was written by Chris Houser. http://blog.fogus.me/2010/09/28/thrush-in-clojure-redux

Takes the first argument and applies the remaining arguments to it as functions from left to right.
This tiny implementation was written by Chris Houser. http://blog.fogus.me/2010/09/28/thrush-in-clojure-redux
raw docstring

trapclj

(trap signal f)

Register signal handling function.

Register signal handling function.
raw docstring

updateclj

(update map key f & args)

Update value in map where f is a function that takes the old value and the supplied args and returns the new value. For efficiency, Do not change map if the old value is the same as the new value. If key is sequential, update all keys in the sequence with the same function.

Update value in map where f is a function that takes the old value and the supplied args and
returns the new value. For efficiency, Do not change map if the old value is the same as the new
value. If key is sequential, update all keys in the sequence with the same function.
raw docstring

update-in!clj

(update-in! m [k & ks] f & args)

'Updates' a value in a nested associative structure, where ks is a sequence of keys and f is a function that will take the old value and any supplied args and return the new value, and returns a new nested structure. The associative structure can have transients in it, but if any levels do not exist, non-transient hash-maps will be created.

'Updates' a value in a nested associative structure, where ks is a sequence of keys and
f is a function that will take the old value and any supplied args and return the new
value, and returns a new nested structure. The associative structure can have transients
in it, but if any levels do not exist, non-transient hash-maps will be created.
raw docstring

verifycljmacro

(verify test exception)

Raise exception unless test returns true.

Raise exception unless test returns true.
raw docstring

while-letcljmacro

(while-let bindings & body)

Repeatedly executes body, which presumably has side-effects, while let binding is not false.

Repeatedly executes body, which presumably has side-effects, while let binding is not false.
raw docstring

wrap-bindingsclj

(wrap-bindings vars f)

Wrap f in a new fuction that re-establishes the current binding for the given vars.

Wrap f in a new fuction that re-establishes the current binding for the given vars.
raw docstring

zipclj

(zip & colls)

Returns a lazy sequence of vectors of corresponding items from each collection. If one collection is longer than the others, the missing items will be filled in with nils.

Returns a lazy sequence of vectors of corresponding items from each collection. If one collection
is longer than the others, the missing items will be filled in with nils.
raw docstring

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

× close