Liking cljdoc? Tell your friends :D

utiliva.core


distinct-byclj

(distinct-by f)
(distinct-by f coll)

Returns a lazy sequence of the elements of coll, removing any elements that return duplicate values when passed to a function f.

Returns a lazy sequence of the elements of coll, removing any
elements that return duplicate values when passed to a function f.
sourceraw docstring

group-byclj

(group-by f coll)
(group-by xform f coll)

Behaves just like clojure.core/group-by, but optionally takes an xform as first argument to transform the inputs before grouping: (group-by (map inc) even? (range 10))

Behaves just like clojure.core/group-by, but optionally takes an xform
as first argument to transform the inputs before grouping:
(group-by (map inc) even? (range 10))
sourceraw docstring

group-likeclj

(group-like flat grouped)

(group-like [:a :b :c :d :e] [[1 2] [3 4 5]]) => [(:a :b) (:c :d :e)]

(group-like [:a :b :c :d :e] [[1 2] [3 4 5]])
=> [(:a :b) (:c :d :e)]
sourceraw docstring

keepclj

(keep f)
(keep f coll)
(keep f coll & colls)

Returns a lazy sequence of the non-nil results of (f item). Note that this means false return values will be included. f must be free of side-effects. Returns a transducer when no collection is provided. Differs from clojure.core/keep in that it can work with multiple collections the way map can.

Returns a lazy sequence of the non-nil results of (f item). Note that this
means false return values will be included. f must be free of side-effects.
Returns a transducer when no collection is provided.
Differs from clojure.core/keep in that it can work with multiple collections
the way map can.
sourceraw docstring

keepcatclj

(keepcat)
(keepcat f)
(keepcat f & colls)

mapcat : map :: keepcat : keep

mapcat : map :: keepcat : keep
sourceraw docstring

locking-vswap!cljmacro

(locking-vswap! vol f & args)

Version of vswap! that locks the volatile.

Version of vswap! that locks the volatile.
sourceraw docstring

map-keysclj

(map-keys f)
(map-keys f k->v)

Maps a function across the keys of a MapEntry collection. Returns a sequence. If you want a new map efficiently constructed, use (into {} (map-keys f) c).

Maps a function across the keys of a MapEntry collection. Returns
a sequence. If you want a new map efficiently constructed, use
(into {} (map-keys f) c).
sourceraw docstring

map-valsclj

(map-vals f)
(map-vals f k->v)

Maps a function across the vals of a MapEntry collection. Returns a sequence. If you want a new map efficiently constructed, use (into {} (map-vals f) c).

Maps a function across the vals of a MapEntry collection. Returns
a sequence. If you want a new map efficiently constructed, use
(into {} (map-vals f) c).
sourceraw docstring

merge-sortedclj

(merge-sorted cs)

Given a number of sorted collections, this returns a vector containing all the items from those collections, sorted.

Given a number of sorted collections, this returns a vector containing all the items
from those collections, sorted.
sourceraw docstring

merge-sorted-byclj

(merge-sorted-by f cs)

Given a number of collections sorted under the projection defined by f, this returns a vector containing all the items from those collections, all sorted under the projection defined by f.

Given a number of collections sorted under the projection defined by f,
this returns a vector containing all the items from those collections, all
sorted under the projection defined by f.
sourceraw docstring

partition-mapclj

(partition-map pred fmap coll)
(partition-map pred fmap coll & colls)

Similar to piecewise-map. This partitions the collection by the result of (pred x) for each x in coll, then applies the functions in fmap directly to the partitions whole, rather than on individual elements. Even so, the element-wise ordering is preserved. Usage: (partition-map even? {true reverse false #(map - %)} (range 10)) If a function is not specified, defaults to the value of :default in fmap; if that is not defined, defaults to identity. Supplied functions are never called on an empty partition.

Similar to piecewise-map. This partitions the collection by the result of (pred x) for
each x in coll, then applies the functions in fmap directly to the partitions whole,
rather than on individual elements. Even so, the element-wise ordering is preserved.
Usage:
(partition-map even? {true reverse false #(map - %)} (range 10))
If a function is not specified, defaults to the value of :default in fmap; if that
is not defined, defaults to identity.
Supplied functions are never called on an empty partition.
sourceraw docstring

partition-pmapclj

(partition-pmap pred fmap coll)
(partition-pmap pred fmap coll & colls)

Similar to piecewise-map. This partitions the collection by the result of (pred x) for each x in coll, then applies the functions in fmap directly to the partitions whole, rather than mapping across them. rather than on individual elements. Even so, the element-wise ordering is preserved. Usage: (partition-map even? {true reverse false #(map - %)} (range 10)) If a function is not specified, defaults to the value of :default in fmap; if that is not defined, defaults to identity. Supplied functions are never called on an empty partition.

Similar to piecewise-map. This partitions the collection by the result of (pred x) for
each x in coll, then applies the functions in fmap directly to the partitions whole,
rather than mapping across them.
rather than on individual elements. Even so, the element-wise ordering is preserved.
Usage:
(partition-map even? {true reverse false #(map - %)} (range 10))
If a function is not specified, defaults to the value of :default in fmap; if that
is not defined, defaults to identity.
Supplied functions are never called on an empty partition.
sourceraw docstring

piecewise-mapclj

(piecewise-map pred fmap)
(piecewise-map pred fmap coll)
(piecewise-map pred fmap coll & colls)

Declaratively defines and maps a piecewise function across a collection, with pieces split on the result of (pred x) for each x in coll. Usage: (piecewise-map even? {true inc, false dec} (range 10)) => (1 0 3 2 5 4 7 6 9 8) If a function is not specified, defaults to the value of :default in fmap; if that is not defined, defaults to identity.

Declaratively defines and maps a piecewise function across a collection, with pieces
split on the result of (pred x) for each x in coll. Usage:
(piecewise-map even? {true inc, false dec} (range 10))
=> (1 0 3 2 5 4 7 6 9 8)
If a function is not specified, defaults to the value of :default in fmap; if that
is not defined, defaults to identity.
sourceraw docstring

piecewise-pmapclj

(piecewise-pmap pred fmap coll)
(piecewise-pmap pred fmap coll & colls)

Declaratively defines and maps a piecewise function across a collection, with pieces split on the result of (pred x) for each x in coll. Usage: (piecewise-map even? {true inc, false dec} (range 10)) => (1 0 3 2 5 4 7 6 9 8) If a function is not specified, defaults to the value of :default in fmap; if that is not defined, defaults to identity.

Declaratively defines and maps a piecewise function across a collection, with pieces
split on the result of (pred x) for each x in coll. Usage:
(piecewise-map even? {true inc, false dec} (range 10))
=> (1 0 3 2 5 4 7 6 9 8)
If a function is not specified, defaults to the value of :default in fmap; if that
is not defined, defaults to identity.
sourceraw docstring

reduce-indexedclj

(reduce-indexed f coll)
(reduce-indexed f val coll)

Similar to map-indexed. The reducing function should take args [res idx val]. More or less equivalent to (reduce-kv f (vec coll)), which would rely on the fact that vectors are indexed.

Similar to map-indexed. The reducing function should take args [res idx val].
More or less equivalent to (reduce-kv f (vec coll)), which would rely on the fact
that vectors are indexed.
sourceraw docstring

sorted-zipmapclj

(sorted-zipmap keys vals)
(sorted-zipmap fn keys vals)

Exactly like zipmap, except the resulting map is sorted. Optionally accepts a comparator. Motivation: faster than zipmapping then sorting.

Exactly like zipmap, except the resulting map is sorted. Optionally accepts a comparator.
Motivation: faster than zipmapping then sorting.
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

zipclj

(zip f1 f2)
(zip f1 f2 c)
(zip f1 f2 c & cs)

Zips two functions across the input collection(s). Returns a MapEntry sequence. Returns a transducer if no collection(s) are provided. Similar to (map juxt).

Zips two functions across the input collection(s). Returns a MapEntry sequence.
Returns a transducer if no collection(s) are provided. Similar to (map juxt).
sourceraw docstring

zip-fromclj

(zip-from c)

Stateful transducer. Create with collection c. Returns a MapEntry seq [c-1 input-1] [c-2 input-2] ... until c is empty or inputs are exhausted.

Stateful transducer. Create with collection c.
Returns a MapEntry seq [c-1 input-1] [c-2 input-2] ... until c is empty or
inputs are exhausted.
sourceraw docstring

zip-toclj

(zip-to c)

Stateful transducer. Create with collection c. Returns a MapEntry seq [input-1 c-1] [input-2 c-2] ... until c is empty or inputs are exhausted.

Stateful transducer. Create with collection c.
Returns a MapEntry seq [input-1 c-1] [input-2 c-2] ... until c is empty or
inputs are exhausted.
sourceraw docstring

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

× close