Every collection fn under one alias: consistent-lib.core's coll-first
wrappers plus aliases for the clojure.core fns that were already coll-first.
(ns my.app
(:require [consistent-lib.ocd :as c]))
(-> {:a 1}
(c/assoc :b 2)
(c/update :a inc)
c/vals
(c/map str))
A superset of consistent-lib.core: use one or the other as the alias, not
both. The coll-first wrappers are the same vars as in consistent-lib.core,
and each alias is the clojure.core fn itself, so behavior and docstrings
are core's own.
Not included, because which argument is the primary collection is not clear
or the fn is not portable or deterministic: merge-with, cons, tree-seq,
into-array, apply, pmap, random-sample, doall, dorun. Use those
from clojure.core.
Same caution as consistent-lib.core: alias it, do not :refer :all it.
Every collection fn under one alias: `consistent-lib.core`'s coll-first
wrappers plus aliases for the `clojure.core` fns that were already coll-first.
(ns my.app
(:require [consistent-lib.ocd :as c]))
(-> {:a 1}
(c/assoc :b 2)
(c/update :a inc)
c/vals
(c/map str))
A superset of `consistent-lib.core`: use one or the other as the alias, not
both. The coll-first wrappers are the same vars as in `consistent-lib.core`,
and each alias is the `clojure.core` fn itself, so behavior and docstrings
are core's own.
Not included, because which argument is the primary collection is not clear
or the fn is not portable or deterministic: `merge-with`, `cons`, `tree-seq`,
`into-array`, `apply`, `pmap`, `random-sample`, `doall`, `dorun`. Use those
from `clojure.core`.
Same caution as `consistent-lib.core`: alias it, do not `:refer :all` it.(assoc map key val)(assoc map key val & kvs)assoc[iate]. When applied to a map, returns a new map of the same (hashed/sorted) type, that contains the mapping of key(s) to val(s). When applied to a vector, returns a new vector that contains val at index. Note - index must be <= (count vector).
assoc[iate]. When applied to a map, returns a new map of the same (hashed/sorted) type, that contains the mapping of key(s) to val(s). When applied to a vector, returns a new vector that contains val at index. Note - index must be <= (count vector).
(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. If any levels do not exist, 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. If any levels do not exist, hash-maps will be created.
(butlast coll)Return a seq of all but the last item in coll, in linear time
Return a seq of all but the last item in coll, in linear time
(concat)(concat x)(concat x y)(concat x y & zs)Returns a lazy seq representing the concatenation of the elements in the supplied colls.
Returns a lazy seq representing the concatenation of the elements in the supplied colls.
(conj)(conj coll)(conj coll x)(conj coll x & xs)conj[oin]. Returns a new collection with the xs 'added'. (conj nil item) returns (item). (conj coll) returns coll. (conj) returns []. The 'addition' may happen at different 'places' depending on the concrete type.
conj[oin]. Returns a new collection with the xs 'added'. (conj nil item) returns (item). (conj coll) returns coll. (conj) returns []. The 'addition' may happen at different 'places' depending on the concrete type.
(contains? coll key)Returns true if key is present in the given collection, otherwise returns false. Note that for numerically indexed collections like vectors and Java arrays, this tests if the numeric key is within the range of indexes. 'contains?' operates constant or logarithmic time; it will not perform a linear search for a value. See also 'some'.
Returns true if key is present in the given collection, otherwise returns false. Note that for numerically indexed collections like vectors and Java arrays, this tests if the numeric key is within the range of indexes. 'contains?' operates constant or logarithmic time; it will not perform a linear search for a value. See also 'some'.
(count coll)Returns the number of items in the collection. (count nil) returns 0. Also works on strings, arrays, and Java Collections and Maps
Returns the number of items in the collection. (count nil) returns 0. Also works on strings, arrays, and Java Collections and Maps
(cycle coll)Returns a lazy (infinite!) sequence of repetitions of the items in coll.
Returns a lazy (infinite!) sequence of repetitions of the items in coll.
(dedupe)(dedupe coll)Returns a lazy sequence removing consecutive duplicates in coll. Returns a transducer when no collection is provided.
Returns a lazy sequence removing consecutive duplicates in coll. Returns a transducer when no collection is provided.
(disj set)(disj set key)(disj set key & ks)disj[oin]. Returns a new set of the same (hashed/sorted) type, that does not contain key(s).
disj[oin]. Returns a new set of the same (hashed/sorted) type, that does not contain key(s).
(dissoc map)(dissoc map key)(dissoc map key & ks)dissoc[iate]. Returns a new map of the same (hashed/sorted) type, that does not contain a mapping for key(s).
dissoc[iate]. Returns a new map of the same (hashed/sorted) type, that does not contain a mapping for key(s).
(distinct)(distinct coll)Returns a lazy sequence of the elements of coll with duplicates removed. Returns a stateful transducer when no collection is provided.
Returns a lazy sequence of the elements of coll with duplicates removed. Returns a stateful transducer when no collection is provided.
(drop n)(drop coll n)consistent-lib: coll-first wrapper for clojure.core/drop — same behavior, collection first (see :arglists above).
Returns a lazy sequence of all but the first n items in coll. Returns a stateful transducer when no collection is provided.
consistent-lib: coll-first wrapper for clojure.core/drop — same behavior, collection first (see :arglists above). Returns a lazy sequence of all but the first n items in coll. Returns a stateful transducer when no collection is provided.
(drop-last coll)(drop-last coll n)consistent-lib: coll-first wrapper for clojure.core/drop-last — same behavior, collection first (see :arglists above).
Return a lazy sequence of all but the last n (default 1) items in coll
consistent-lib: coll-first wrapper for clojure.core/drop-last — same behavior, collection first (see :arglists above). Return a lazy sequence of all but the last n (default 1) items in coll
(drop-while pred)(drop-while coll pred)consistent-lib: coll-first wrapper for clojure.core/drop-while — same behavior, collection first (see :arglists above).
Returns a lazy sequence of the items in coll starting from the first item for which (pred item) returns logical false. Returns a stateful transducer when no collection is provided.
consistent-lib: coll-first wrapper for clojure.core/drop-while — same behavior, collection first (see :arglists above). Returns a lazy sequence of the items in coll starting from the first item for which (pred item) returns logical false. Returns a stateful transducer when no collection is provided.
(eduction coll & xforms)consistent-lib: coll-first wrapper for clojure.core/eduction — same behavior, collection first (see :arglists above).
Returns a reducible/iterable application of the transducers to the items in coll. Transducers are applied in order as if combined with comp. Note that these applications will be performed every time reduce/iterator is called.
consistent-lib: coll-first wrapper for clojure.core/eduction — same behavior, collection first (see :arglists above). Returns a reducible/iterable application of the transducers to the items in coll. Transducers are applied in order as if combined with comp. Note that these applications will be performed every time reduce/iterator is called.
(empty coll)Returns an empty collection of the same category as coll, or nil
Returns an empty collection of the same category as coll, or nil
(empty? coll)Returns true if coll has no items - same as (not (seq coll)). Please use the idiom (seq x) rather than (not (empty? x))
Returns true if coll has no items - same as (not (seq coll)). Please use the idiom (seq x) rather than (not (empty? x))
(every? coll pred)consistent-lib: coll-first wrapper for clojure.core/every? — same behavior, collection first (see :arglists above).
Returns true if (pred x) is logical true for every x in coll, else false.
consistent-lib: coll-first wrapper for clojure.core/every? — same behavior, collection first (see :arglists above). Returns true if (pred x) is logical true for every x in coll, else false.
(filter pred)(filter coll pred)consistent-lib: coll-first wrapper for clojure.core/filter — same behavior, collection first (see :arglists above).
Returns a lazy sequence of the items in coll for which (pred item) returns logical true. pred must be free of side-effects. Returns a transducer when no collection is provided.
consistent-lib: coll-first wrapper for clojure.core/filter — same behavior, collection first (see :arglists above). Returns a lazy sequence of the items in coll for which (pred item) returns logical true. pred must be free of side-effects. Returns a transducer when no collection is provided.
(filterv coll pred)consistent-lib: coll-first wrapper for clojure.core/filterv — same behavior, collection first (see :arglists above).
Returns a vector of the items in coll for which (pred item) returns logical true. pred must be free of side-effects.
consistent-lib: coll-first wrapper for clojure.core/filterv — same behavior, collection first (see :arglists above). Returns a vector of the items in coll for which (pred item) returns logical true. pred must be free of side-effects.
(find map key)Returns the map entry for key, or nil if key not present.
Returns the map entry for key, or nil if key not present.
(first coll)Returns the first item in the collection. Calls seq on its argument. If coll is nil, returns nil.
Returns the first item in the collection. Calls seq on its argument. If coll is nil, returns nil.
(flatten x)Takes any nested combination of sequential things (lists, vectors, etc.) and returns their contents as a single, flat lazy sequence. (flatten nil) returns an empty sequence.
Takes any nested combination of sequential things (lists, vectors, etc.) and returns their contents as a single, flat lazy sequence. (flatten nil) returns an empty sequence.
(frequencies coll)Returns a map from distinct items in coll to the number of times they appear.
Returns a map from distinct items in coll to the number of times they appear.
(get map key)(get map key not-found)Returns the value mapped to key, not-found or nil if key not present.
Returns the value mapped to key, not-found or nil if key not present.
(get-in m ks)(get-in m ks not-found)Returns the value in a nested associative structure, where ks is a sequence of keys. Returns nil if the key is not present, or the not-found value if supplied.
Returns the value in a nested associative structure, where ks is a sequence of keys. Returns nil if the key is not present, or the not-found value if supplied.
(group-by coll f)consistent-lib: coll-first wrapper for clojure.core/group-by — same behavior, collection first (see :arglists above).
Returns a map of the elements of coll keyed by the result of f on each element. The value at each key will be a vector of the corresponding elements, in the order they appeared in coll.
consistent-lib: coll-first wrapper for clojure.core/group-by — same behavior, collection first (see :arglists above). Returns a map of the elements of coll keyed by the result of f on each element. The value at each key will be a vector of the corresponding elements, in the order they appeared in coll.
(interleave)(interleave c1)(interleave c1 c2)(interleave c1 c2 & colls)Returns a lazy seq of the first item in each coll, then the second etc.
Returns a lazy seq of the first item in each coll, then the second etc.
(interpose separator)(interpose coll separator)consistent-lib: coll-first wrapper for clojure.core/interpose — same behavior, collection first (see :arglists above).
Returns a lazy seq of the elements of coll separated by sep. Returns a stateful transducer when no collection is provided.
consistent-lib: coll-first wrapper for clojure.core/interpose — same behavior, collection first (see :arglists above). Returns a lazy seq of the elements of coll separated by sep. Returns a stateful transducer when no collection is provided.
(into)(into to)(into to from)(into to xform from)Returns a new coll consisting of to-coll with all of the items of from-coll conjoined. A transducer may be supplied.
Returns a new coll consisting of to-coll with all of the items of from-coll conjoined. A transducer may be supplied.
(keep f)(keep coll f)consistent-lib: coll-first wrapper for clojure.core/keep — same behavior, collection first (see :arglists above).
Returns a lazy sequence of the non-nil results of (f item). Note, this means false return values will be included. f must be free of side-effects. Returns a transducer when no collection is provided.
consistent-lib: coll-first wrapper for clojure.core/keep — same behavior, collection first (see :arglists above). Returns a lazy sequence of the non-nil results of (f item). Note, this means false return values will be included. f must be free of side-effects. Returns a transducer when no collection is provided.
(keep-indexed f)(keep-indexed coll f)consistent-lib: coll-first wrapper for clojure.core/keep-indexed — same behavior, collection first (see :arglists above).
Returns a lazy sequence of the non-nil results of (f index item). Note, this means false return values will be included. f must be free of side-effects. Returns a stateful transducer when no collection is provided.
consistent-lib: coll-first wrapper for clojure.core/keep-indexed — same behavior, collection first (see :arglists above). Returns a lazy sequence of the non-nil results of (f index item). Note, this means false return values will be included. f must be free of side-effects. Returns a stateful transducer when no collection is provided.
(keys map)Returns a sequence of the map's keys, in the same order as (seq map).
Returns a sequence of the map's keys, in the same order as (seq map).
(last coll)Return the last item in coll, in linear time
Return the last item in coll, in linear time
(map f)(map coll f)(map coll f c2)(map coll f c2 c3)(map coll f c2 c3 & colls)consistent-lib: coll-first wrapper for clojure.core/map — same behavior, collection first (see :arglists above).
Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments. Returns a transducer when no collection is provided.
consistent-lib: coll-first wrapper for clojure.core/map — same behavior, collection first (see :arglists above). Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments. Returns a transducer when no collection is provided.
(map-indexed f)(map-indexed coll f)consistent-lib: coll-first wrapper for clojure.core/map-indexed — same behavior, collection first (see :arglists above).
Returns a lazy sequence consisting of the result of applying f to 0 and the first item of coll, followed by applying f to 1 and the second item in coll, etc, until coll is exhausted. Thus function f should accept 2 arguments, index and item. Returns a stateful transducer when no collection is provided.
consistent-lib: coll-first wrapper for clojure.core/map-indexed — same behavior, collection first (see :arglists above). Returns a lazy sequence consisting of the result of applying f to 0 and the first item of coll, followed by applying f to 1 and the second item in coll, etc, until coll is exhausted. Thus function f should accept 2 arguments, index and item. Returns a stateful transducer when no collection is provided.
(mapcat f)(mapcat coll f & colls)consistent-lib: coll-first wrapper for clojure.core/mapcat — same behavior, collection first (see :arglists above).
Returns the result of applying concat to the result of applying map to f and colls. Thus function f should return a collection. Returns a transducer when no collections are provided
consistent-lib: coll-first wrapper for clojure.core/mapcat — same behavior, collection first (see :arglists above). Returns the result of applying concat to the result of applying map to f and colls. Thus function f should return a collection. Returns a transducer when no collections are provided
(mapv coll f)(mapv coll f c2)(mapv coll f c2 c3)(mapv coll f c2 c3 & colls)consistent-lib: coll-first wrapper for clojure.core/mapv — same behavior, collection first (see :arglists above).
Returns a vector consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments.
consistent-lib: coll-first wrapper for clojure.core/mapv — same behavior, collection first (see :arglists above). Returns a vector consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments.
(merge & maps)Returns a map that consists of the rest of the maps conj-ed onto the first. If a key occurs in more than one map, the mapping from the latter (left-to-right) will be the mapping in the result.
Returns a map that consists of the rest of the maps conj-ed onto the first. If a key occurs in more than one map, the mapping from the latter (left-to-right) will be the mapping in the result.
(next coll)Returns a seq of the items after the first. Calls seq on its argument. If there are no more items, returns nil.
Returns a seq of the items after the first. Calls seq on its argument. If there are no more items, returns nil.
(not-any? coll pred)consistent-lib: coll-first wrapper for clojure.core/not-any? — same behavior, collection first (see :arglists above).
Returns false if (pred x) is logical true for any x in coll, else true.
consistent-lib: coll-first wrapper for clojure.core/not-any? — same behavior, collection first (see :arglists above). Returns false if (pred x) is logical true for any x in coll, else true.
(not-empty coll)If coll is empty, returns nil, else coll
If coll is empty, returns nil, else coll
(not-every? coll pred)consistent-lib: coll-first wrapper for clojure.core/not-every? — same behavior, collection first (see :arglists above).
Returns false if (pred x) is logical true for every x in coll, else true.
consistent-lib: coll-first wrapper for clojure.core/not-every? — same behavior, collection first (see :arglists above). Returns false if (pred x) is logical true for every x in coll, else true.
(nth coll index)(nth coll index not-found)Returns the value at the index. get returns nil if index out of bounds, nth throws an exception unless not-found is supplied. nth also works for strings, Java arrays, regex Matchers and Lists, and, in O(n) time, for sequences.
Returns the value at the index. get returns nil if index out of bounds, nth throws an exception unless not-found is supplied. nth also works for strings, Java arrays, regex Matchers and Lists, and, in O(n) time, for sequences.
(partition coll n)(partition coll n step)(partition coll n step pad)consistent-lib: coll-first wrapper for clojure.core/partition — same behavior, collection first (see :arglists above).
Returns a lazy sequence of lists of n items each, at offsets step apart. If step is not supplied, defaults to n, i.e. the partitions do not overlap. If a pad collection is supplied, use its elements as necessary to complete last partition upto n items. In case there are not enough padding elements, return a partition with less than n items.
consistent-lib: coll-first wrapper for clojure.core/partition — same behavior, collection first (see :arglists above). Returns a lazy sequence of lists of n items each, at offsets step apart. If step is not supplied, defaults to n, i.e. the partitions do not overlap. If a pad collection is supplied, use its elements as necessary to complete last partition upto n items. In case there are not enough padding elements, return a partition with less than n items.
(partition-all n)(partition-all coll n)(partition-all coll n step)consistent-lib: coll-first wrapper for clojure.core/partition-all — same behavior, collection first (see :arglists above).
Returns a lazy sequence of lists like partition, but may include partitions with fewer than n items at the end. Returns a stateful transducer when no collection is provided.
consistent-lib: coll-first wrapper for clojure.core/partition-all — same behavior, collection first (see :arglists above). Returns a lazy sequence of lists like partition, but may include partitions with fewer than n items at the end. Returns a stateful transducer when no collection is provided.
(partition-by f)(partition-by coll f)consistent-lib: coll-first wrapper for clojure.core/partition-by — same behavior, collection first (see :arglists above).
Applies f to each value in coll, splitting it each time f returns a new value. Returns a lazy seq of partitions. Returns a stateful transducer when no collection is provided.
consistent-lib: coll-first wrapper for clojure.core/partition-by — same behavior, collection first (see :arglists above). Applies f to each value in coll, splitting it each time f returns a new value. Returns a lazy seq of partitions. Returns a stateful transducer when no collection is provided.
(peek coll)For a list or queue, same as first, for a vector, same as, but much more efficient than, last. If the collection is empty, returns nil.
For a list or queue, same as first, for a vector, same as, but much more efficient than, last. If the collection is empty, returns nil.
(pop coll)For a list or queue, returns a new list/queue without the first item, for a vector, returns a new vector without the last item. If the collection is empty, throws an exception. Note - not the same as next/butlast.
For a list or queue, returns a new list/queue without the first item, for a vector, returns a new vector without the last item. If the collection is empty, throws an exception. Note - not the same as next/butlast.
(rand-nth coll)Return a random element of the (sequential) collection. Will have the same performance characteristics as nth for the given collection.
Return a random element of the (sequential) collection. Will have the same performance characteristics as nth for the given collection.
(reduce coll f)(reduce coll f init)consistent-lib: coll-first wrapper for clojure.core/reduce — same behavior, collection first (see :arglists above).
f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well, and reduce returns the result of calling f with no arguments. If coll has only 1 item, it is returned and f is not called. If val is supplied, returns the result of applying f to val and the first item in coll, then applying f to that result and the 2nd item, etc. If coll contains no items, returns val and f is not called.
consistent-lib: coll-first wrapper for clojure.core/reduce — same behavior, collection first (see :arglists above). f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well, and reduce returns the result of calling f with no arguments. If coll has only 1 item, it is returned and f is not called. If val is supplied, returns the result of applying f to val and the first item in coll, then applying f to that result and the 2nd item, etc. If coll contains no items, returns val and f is not called.
(reduce-kv coll f init)consistent-lib: coll-first wrapper for clojure.core/reduce-kv — same behavior, collection first (see :arglists above).
Reduces an associative collection. f should be a function of 3 arguments. Returns the result of applying f to init, the first key and the first value in coll, then applying f to that result and the 2nd key and value, etc. If coll contains no entries, returns init and f is not called. Note that reduce-kv is supported on vectors, where the keys will be the ordinals.
consistent-lib: coll-first wrapper for clojure.core/reduce-kv — same behavior, collection first (see :arglists above). Reduces an associative collection. f should be a function of 3 arguments. Returns the result of applying f to init, the first key and the first value in coll, then applying f to that result and the 2nd key and value, etc. If coll contains no entries, returns init and f is not called. Note that reduce-kv is supported on vectors, where the keys will be the ordinals.
(reductions coll f)(reductions coll f init)consistent-lib: coll-first wrapper for clojure.core/reductions — same behavior, collection first (see :arglists above).
Returns a lazy seq of the intermediate values of the reduction (as per reduce) of coll by f, starting with init.
consistent-lib: coll-first wrapper for clojure.core/reductions — same behavior, collection first (see :arglists above). Returns a lazy seq of the intermediate values of the reduction (as per reduce) of coll by f, starting with init.
(remove pred)(remove coll pred)consistent-lib: coll-first wrapper for clojure.core/remove — same behavior, collection first (see :arglists above).
Returns a lazy sequence of the items in coll for which (pred item) returns logical false. pred must be free of side-effects. Returns a transducer when no collection is provided.
consistent-lib: coll-first wrapper for clojure.core/remove — same behavior, collection first (see :arglists above). Returns a lazy sequence of the items in coll for which (pred item) returns logical false. pred must be free of side-effects. Returns a transducer when no collection is provided.
(replace smap)(replace coll smap)consistent-lib: coll-first wrapper for clojure.core/replace — same behavior, collection first (see :arglists above).
Given a map of replacement pairs and a vector/collection, returns a vector/seq with any elements = a key in smap replaced with the corresponding val in smap. Returns a transducer when no collection is provided.
consistent-lib: coll-first wrapper for clojure.core/replace — same behavior, collection first (see :arglists above). Given a map of replacement pairs and a vector/collection, returns a vector/seq with any elements = a key in smap replaced with the corresponding val in smap. Returns a transducer when no collection is provided.
(rest coll)Returns a possibly empty seq of the items after the first. Calls seq on its argument.
Returns a possibly empty seq of the items after the first. Calls seq on its argument.
(reverse coll)Returns a seq of the items in coll in reverse order. Not lazy.
Returns a seq of the items in coll in reverse order. Not lazy.
(rseq rev)Returns, in constant time, a seq of the items in rev (which can be a vector or sorted-map), in reverse order. If rev is empty returns nil
Returns, in constant time, a seq of the items in rev (which can be a vector or sorted-map), in reverse order. If rev is empty returns nil
(run! coll proc)consistent-lib: coll-first wrapper for clojure.core/run! — same behavior, collection first (see :arglists above).
Runs the supplied procedure (via reduce), for purposes of side effects, on successive items in the collection. Returns nil
consistent-lib: coll-first wrapper for clojure.core/run! — same behavior, collection first (see :arglists above). Runs the supplied procedure (via reduce), for purposes of side effects, on successive items in the collection. Returns nil
(select-keys map keyseq)Returns a map containing only those entries in map whose key is in keys
Returns a map containing only those entries in map whose key is in keys
(seq coll)Returns a seq on the collection. If the collection is empty, returns nil. (seq nil) returns nil. seq also works on Strings, native Java arrays (of reference types) and any objects that implement Iterable. Note that seqs cache values, thus seq should not be used on any Iterable whose iterator repeatedly returns the same mutable object.
Returns a seq on the collection. If the collection is empty, returns nil. (seq nil) returns nil. seq also works on Strings, native Java arrays (of reference types) and any objects that implement Iterable. Note that seqs cache values, thus seq should not be used on any Iterable whose iterator repeatedly returns the same mutable object.
(sequence coll)(sequence coll xform)(sequence coll xform & colls)consistent-lib: coll-first wrapper for clojure.core/sequence — same behavior, collection first (see :arglists above).
Coerces coll to a (possibly empty) sequence, if it is not already one. Will not force a lazy seq. (sequence nil) yields (), When a transducer is supplied, returns a lazy sequence of applications of the transform to the items in coll(s), i.e. to the set of first items of each coll, followed by the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. The transform should accept number-of-colls arguments
consistent-lib: coll-first wrapper for clojure.core/sequence — same behavior, collection first (see :arglists above). Coerces coll to a (possibly empty) sequence, if it is not already one. Will not force a lazy seq. (sequence nil) yields (), When a transducer is supplied, returns a lazy sequence of applications of the transform to the items in coll(s), i.e. to the set of first items of each coll, followed by the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. The transform should accept number-of-colls arguments
(set coll)Returns a set of the distinct elements of coll.
Returns a set of the distinct elements of coll.
(shuffle coll)Return a random permutation of coll
Return a random permutation of coll
(some coll pred)consistent-lib: coll-first wrapper for clojure.core/some — same behavior, collection first (see :arglists above).
Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)
consistent-lib: coll-first wrapper for clojure.core/some — same behavior, collection first (see :arglists above).
Returns the first logical true value of (pred x) for any x in coll,
else nil. One common idiom is to use a set as pred, for example
this will return :fred if :fred is in the sequence, otherwise nil:
(some #{:fred} coll)(sort coll)(sort coll comp)consistent-lib: coll-first wrapper for clojure.core/sort — same behavior, collection first (see :arglists above).
Returns a sorted sequence of the items in coll. If no comparator is supplied, uses compare. comparator must implement java.util.Comparator. Guaranteed to be stable: equal elements will not be reordered. If coll is a Java array, it will be modified. To avoid this, sort a copy of the array.
consistent-lib: coll-first wrapper for clojure.core/sort — same behavior, collection first (see :arglists above). Returns a sorted sequence of the items in coll. If no comparator is supplied, uses compare. comparator must implement java.util.Comparator. Guaranteed to be stable: equal elements will not be reordered. If coll is a Java array, it will be modified. To avoid this, sort a copy of the array.
(sort-by coll keyfn)(sort-by coll keyfn comp)consistent-lib: coll-first wrapper for clojure.core/sort-by — same behavior, collection first (see :arglists above).
Returns a sorted sequence of the items in coll, where the sort order is determined by comparing (keyfn item). If no comparator is supplied, uses compare. comparator must implement java.util.Comparator. Guaranteed to be stable: equal elements will not be reordered. If coll is a Java array, it will be modified. To avoid this, sort a copy of the array.
consistent-lib: coll-first wrapper for clojure.core/sort-by — same behavior, collection first (see :arglists above). Returns a sorted sequence of the items in coll, where the sort order is determined by comparing (keyfn item). If no comparator is supplied, uses compare. comparator must implement java.util.Comparator. Guaranteed to be stable: equal elements will not be reordered. If coll is a Java array, it will be modified. To avoid this, sort a copy of the array.
(split-at coll idx)consistent-lib: coll-first wrapper for clojure.core/split-at — same behavior, collection first (see :arglists above).
Returns a vector of [(take n coll) (drop n coll)]
consistent-lib: coll-first wrapper for clojure.core/split-at — same behavior, collection first (see :arglists above). Returns a vector of [(take n coll) (drop n coll)]
(split-with coll pred)consistent-lib: coll-first wrapper for clojure.core/split-with — same behavior, collection first (see :arglists above).
Returns a vector of [(take-while pred coll) (drop-while pred coll)]
consistent-lib: coll-first wrapper for clojure.core/split-with — same behavior, collection first (see :arglists above). Returns a vector of [(take-while pred coll) (drop-while pred coll)]
(subvec v start)(subvec v start end)Returns a persistent vector of the items in vector from start (inclusive) to end (exclusive). If end is not supplied, defaults to (count vector). This operation is O(1) and very fast, as the resulting vector shares structure with the original and no trimming is done.
Returns a persistent vector of the items in vector from start (inclusive) to end (exclusive). If end is not supplied, defaults to (count vector). This operation is O(1) and very fast, as the resulting vector shares structure with the original and no trimming is done.
(take n)(take coll n)consistent-lib: coll-first wrapper for clojure.core/take — same behavior, collection first (see :arglists above).
Returns a lazy sequence of the first n items in coll, or all items if there are fewer than n. Returns a stateful transducer when no collection is provided.
consistent-lib: coll-first wrapper for clojure.core/take — same behavior, collection first (see :arglists above). Returns a lazy sequence of the first n items in coll, or all items if there are fewer than n. Returns a stateful transducer when no collection is provided.
(take-last coll n)consistent-lib: coll-first wrapper for clojure.core/take-last — same behavior, collection first (see :arglists above).
Returns a seq of the last n items in coll. Depending on the type of coll may be no better than linear time. For vectors, see also subvec.
consistent-lib: coll-first wrapper for clojure.core/take-last — same behavior, collection first (see :arglists above). Returns a seq of the last n items in coll. Depending on the type of coll may be no better than linear time. For vectors, see also subvec.
(take-nth n)(take-nth coll n)consistent-lib: coll-first wrapper for clojure.core/take-nth — same behavior, collection first (see :arglists above).
Returns a lazy seq of every nth item in coll. Returns a stateful transducer when no collection is provided.
consistent-lib: coll-first wrapper for clojure.core/take-nth — same behavior, collection first (see :arglists above). Returns a lazy seq of every nth item in coll. Returns a stateful transducer when no collection is provided.
(take-while pred)(take-while coll pred)consistent-lib: coll-first wrapper for clojure.core/take-while — same behavior, collection first (see :arglists above).
Returns a lazy sequence of successive items from coll while (pred item) returns logical true. pred must be free of side-effects. Returns a transducer when no collection is provided.
consistent-lib: coll-first wrapper for clojure.core/take-while — same behavior, collection first (see :arglists above). Returns a lazy sequence of successive items from coll while (pred item) returns logical true. pred must be free of side-effects. Returns a transducer when no collection is provided.
(transduce coll xform f)(transduce coll xform f init)consistent-lib: coll-first wrapper for clojure.core/transduce — same behavior, collection first (see :arglists above).
reduce with a transformation of f (xf). If init is not supplied, (f) will be called to produce it. f should be a reducing step function that accepts both 1 and 2 arguments, if it accepts only 2 you can add the arity-1 with 'completing'. Returns the result of applying (the transformed) xf to init and the first item in coll, then applying xf to that result and the 2nd item, etc. If coll contains no items, returns init and f is not called. Note that certain transforms may inject or skip items.
consistent-lib: coll-first wrapper for clojure.core/transduce — same behavior, collection first (see :arglists above). reduce with a transformation of f (xf). If init is not supplied, (f) will be called to produce it. f should be a reducing step function that accepts both 1 and 2 arguments, if it accepts only 2 you can add the arity-1 with 'completing'. Returns the result of applying (the transformed) xf to init and the first item in coll, then applying xf to that result and the 2nd item, etc. If coll contains no items, returns init and f is not called. Note that certain transforms may inject or skip items.
(update m k f)(update m k f x)(update m k f x y)(update m k f x y z)(update m k f x y z & more)'Updates' a value in an associative structure, where k is a key and f is a function that will take the old value and any supplied args and return the new value, and returns a new structure. If the key does not exist, nil is passed as the old value.
'Updates' a value in an associative structure, where k is a key and f is a function that will take the old value and any supplied args and return the new value, and returns a new structure. If the key does not exist, nil is passed as the old value.
(update-in m 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. If any levels do not exist, 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. If any levels do not exist, hash-maps will be created.
(vals map)Returns a sequence of the map's values, in the same order as (seq map).
Returns a sequence of the map's values, in the same order as (seq map).
(vec coll)Creates a new vector containing the contents of coll. Java arrays will be aliased and should not be modified.
Creates a new vector containing the contents of coll. Java arrays will be aliased and should not be modified.
(zipmap keys vals)Returns a map with the keys mapped to the corresponding vals.
Returns a map with the keys mapped to the corresponding vals.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |