(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.
(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))
(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)]
(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.
(keepcat)
(keepcat f)
(keepcat f & colls)
mapcat : map :: keepcat : keep
mapcat : map :: keepcat : keep
(locking-vswap! vol f & args)
Version of vswap! that locks the volatile.
Version of vswap! that locks the volatile.
(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).
(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).
(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.
(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.
(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.
(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.
(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.
(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.
(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.
(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.
(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.
(thread-local* init)
Non-macro version of thread-local - see documentation for same.
Non-macro version of thread-local - see documentation for same.
(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).
(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.
(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.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close