Skip to main content

Collections

  • count

    Returns the number of items in the collection. (count nil) returns 0. Also works on strings, arrays, and Java Collect...

  • empty

    Returns an empty collection of the same category as coll, or nil

  • find

    Returns the map entry for key, or nil if key not present.

  • first

    Returns the first item in the collection. Calls seq on its argument. If coll is nil, returns nil.

  • get

    Returns the value mapped to key, not-found or nil if key not present in associative collection, set, string, array, or...

  • get-in

    Returns the value in a nested associative structure, where ks is a sequence of keys. Returns nil if the key is not p...

  • key

    Returns the key of the map entry.

  • keys

    Returns a sequence of the map's keys, in the same order as (seq map).

  • last

    Return the last item in coll, in linear time

  • next

    Returns a seq of the items after the first. Calls seq on its argument. If there are no more items, returns nil.

  • nth

    Returns the value at the index. get returns nil if index out of bounds, nth throws an exception unless not-found is su...

  • peek

    For a list or queue, same as first, for a vector, same as, but much more efficient than, last. If the collection is em...

  • rest

    Returns a possibly empty seq of the items after the first. Calls seq on its argument.

  • second

    Same as (first (next x))

  • seq

    Returns a seq on the collection. If the collection is empty, returns nil. (seq nil) returns nil. seq also works on ...

  • sequence

    Coerces coll to a (possibly empty) sequence, if it is not already one. Will not force a lazy seq. (sequence nil) yield...

  • val

    Returns the value in the map entry.

  • vals

    Returns a sequence of the map's values, in the same order as (seq map).

  • ->BasicCache

    Positional factory function for class clojure.core.cache.BasicCache.

  • ->FIFOCache

    Positional factory function for class clojure.core.cache.FIFOCache.

  • ->FnCache

    Positional factory function for class clojure.core.cache.FnCache.

  • ->LIRSCache

    Positional factory function for class clojure.core.cache.LIRSCache.

  • ->LRUCache

    Positional factory function for class clojure.core.cache.LRUCache.

  • ->LUCache

    Positional factory function for class clojure.core.cache.LUCache.

  • ->SoftCache

    Positional factory function for class clojure.core.cache.SoftCache.

  • ->TTLCacheQ

    Positional factory function for class clojure.core.cache.TTLCacheQ.

  • CacheProtocol

    This is the protocol describing the basic cache capability.

  • basic-cache-factory

    Returns a pluggable basic cache initialized to `base`

  • evict

    Removes an entry from the cache

  • fifo-cache-factory

    Returns a FIFO cache with the cache and FIFO queue initialized to `base` -- the queue is filled as the values are pul...

  • has?

    Checks if the cache contains a value associated with `e`

  • hit

    Is meant to be called if the cache is determined to contain a value associated with `e`

  • lirs-cache-factory

    Returns an LIRS cache with the S & R LRU lists set to the indicated limits.

  • lookup

    Retrieve the value associated with `e` if it exists, else `nil` in the 2-arg case. Retrieve the value associated wit...

  • lru-cache-factory

    Returns an LRU cache with the cache and usage-table initialized to `base` -- each entry is initialized with the same ...

  • lu-cache-factory

    Returns an LU cache with the cache and usage-table initialized to `base`. This function takes an optional `:threshol...

  • miss

    Is meant to be called if the cache is determined to **not** contain a value associated with `e`

  • seed

    Is used to signal that the cache should be created with a seed. The contract is that said cache should return an inst...

  • soft-cache-factory

    Returns a SoftReference cache. Cached values will be referred to with SoftReferences, allowing the values to be garba...

  • through

    The basic hit/miss logic for the cache system. Expects a wrap function and value function. The wrap function takes t...

  • through-cache

    The basic hit/miss logic for the cache system. Like through but always has the cache argument in the first position f...

  • ttl-cache-factory

    Returns a TTL cache with the cache and expiration-table initialized to `base` -- each with the same time-to-live. ...

  • array-map

    Constructs an array-map. If any keys are equal, they are handled as if by repeated uses of assoc.

  • cycle

    Returns a lazy (infinite!) sequence of repetitions of the items in coll.

  • hash-map

    keyval => key val Returns a new hash map with supplied mappings. If any keys are equal, they are handled as if by r...

  • hash-set

    Returns a new hash set with supplied keys. Any equal keys are handled as if by repeated uses of conj.

  • iterate

    Returns a lazy (infinite!) sequence of x, (f x), (f (f x)) etc. f must be free of side-effects

  • lazy-seq

    Takes a body of expressions that returns an ISeq or nil, and yields a Seqable object that will invoke the body only th...

  • list

    Creates a new list containing the items.

  • list*

    Creates a new seq containing the items prepended to the rest, the last of which will be treated as a sequence.

  • range

    Returns a lazy seq of nums from start (inclusive) to end (exclusive), by step, where start defaults to 0, step to 1, a...

  • repeat

    Returns a lazy (infinite!, or length n if supplied) sequence of xs.

  • repeatedly

    Takes a function of no args, presumably with side effects, and returns an infinite (or length n if supplied) lazy sequ...

  • set

    Returns a set of the distinct elements of coll.

  • sorted-map

    keyval => key val Returns a new sorted map with supplied mappings. If any keys are equal, they are handled as if by...

  • sorted-map-by

    keyval => key val Returns a new sorted map with supplied mappings, using the supplied comparator. If any keys are e...

  • sorted-set

    Returns a new sorted set with supplied keys. Any equal keys are handled as if by repeated uses of conj.

  • sorted-set-by

    Returns a new sorted set with supplied keys, using the supplied comparator. Any equal keys are handled as if by repea...

  • vec

    Creates a new vector containing the contents of coll. Java arrays will be aliased and should not be modified.

  • vector

    Creates a new vector containing the args.

  • vector-of

    Creates a new vector of a single primitive type t, where t is one of :int :long :float :double :byte :short :char or :...

  • zipmap

    Returns a map with the keys mapped to the corresponding vals.

  • assoc

    assoc[iate]. When applied to a map, returns a new map of the same (hashed/sorted) type, that contains the mapping of...

  • assoc-in

    Associates a value in a nested associative structure, where ks is a sequence of keys and v is the new value and return...

  • conj

    conj[oin]. Returns a new collection with the xs 'added'. (conj nil item) returns (item). (conj coll) returns col...

  • cons

    Returns a new seq where x is the first element and seq is the rest.

  • disj

    disj[oin]. Returns a new set of the same (hashed/sorted) type, that does not contain key(s).

  • dissoc

    dissoc[iate]. Returns a new map of the same (hashed/sorted) type, that does not contain a mapping for key(s).

  • pop

    For a list or queue, returns a new list/queue without the first item, for a vector, returns a new vector without the l...

  • update

    'Updates' a value in an associative structure, where k is a key and f is a function that will take the old value and...

  • update-in

    'Updates' a value in a nested associative structure, where ks is a sequence of keys and f is a function that will take...

  • associative?

    Returns true if coll implements Associative

  • coll?

    Returns true if x implements IPersistentCollection

  • contains?

    Returns true if key is present in the given collection, otherwise returns false. Note that for numerically indexed co...

  • counted?

    Returns true if coll implements count in constant time

  • distinct?

    Returns true if no two of the arguments are =

  • empty?

    Returns true if coll has no items. To check the emptiness of a seq, please use the idiom (seq x) rather than (not (emp...

  • every?

    Returns true if (pred x) is logical true for every x in coll, else false.

  • indexed?

    Return true if coll implements Indexed, indicating efficient lookup by index

  • list?

    Returns true if x implements IPersistentList

  • map-entry?

    Return true if x is a map entry

  • map?

    Return true if x implements IPersistentMap

  • not-any?

    Returns false if (pred x) is logical true for any x in coll, else true.

  • not-empty

    If coll is empty, returns nil, else coll

  • not-every?

    Returns false if (pred x) is logical true for every x in coll, else true.

  • record?

    Returns true if x is a record

  • reversible?

    Returns true if coll implements Reversible

  • seq?

    Return true if x implements ISeq

  • seqable?

    Return true if the seq function is supported for x

  • sequential?

    Returns true if coll implements Sequential

  • set?

    Returns true if x implements IPersistentSet

  • some

    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 pre...

  • sorted?

    Returns true if coll implements Sorted

  • vector?

    Return true if x implements IPersistentVector

  • ->PersistentPriorityMap

    Positional factory function for class clojure.data.priority_map.PersistentPriorityMap.

  • priority->set-of-items

    Takes a priority map p, and returns a sorted map from each priority to the set of items with that priority in p

  • priority-map

    Usage: (priority-map key val key val ...) Returns a new priority map with optional supplied mappings. (priority-map)...

  • priority-map-by

    Usage: (priority-map comparator key val key val ...) Returns a new priority map with custom comparator and optional su...

  • priority-map-keyfn

    Usage: (priority-map-keyfn keyfn key val key val ...) Returns a new priority map with custom keyfn and optional suppli...

  • priority-map-keyfn-by

    Usage: (priority-map-keyfn-by keyfn comparator key val key val ...) Returns a new priority map with custom keyfn, cust...

  • rsubseq

    sc must be a sorted collection, test(s) one of <, <=, > or >=. Returns a reverse seq of those entries with keys ek for...

  • subseq

    sc must be a sorted collection, test(s) one of <, <=, > or >=. Returns a seq of those entries with keys ek for which...

  • ->Cat

    Positional factory function for class clojure.core.reducers.Cat.

  • append!

    .adds x to acc and returns acc

  • cat

    A high-performance combining fn that yields the catenation of the reduced values. The result is reducible, foldable, s...

  • drop

    Elides the first n values from the reduction of coll.

  • filter

    Retains values in the reduction of coll for which (pred val) returns logical true. Foldable.

  • flatten

    Takes any nested combination of sequential things (lists, vectors, etc.) and returns their contents as a single, flat ...

  • fold

    Reduces a collection using a (potentially parallel) reduce-combine strategy. The collection is partitioned into groups...

  • foldcat

    Equivalent to (fold cat append! coll)

  • folder

    Given a foldable collection, and a transformation function xf, returns a foldable collection, where any supplied reduc...

  • map

    Applies f to every value in the reduction of coll. Foldable.

  • mapcat

    Applies f to every value in the reduction of coll, concatenating the result colls of (f val). Foldable.

  • monoid

    Builds a combining fn out of the supplied operator and identity constructor. op must be associative and ctor called wi...

  • reduce

    Like core/reduce except: When init is not provided, (f) is used. Maps are reduced with reduce-kv

  • reducer

    Given a reducible collection, and a transformation function xf, returns a reducible collection, where any supplied red...

  • remove

    Removes values in the reduction of coll for which (pred val) returns logical true. Foldable.

  • take

    Ends the reduction of coll after consuming n values.

  • take-while

    Ends the reduction of coll when (pred val) returns logical false.

  • difference

    Return a set that is the first set without elements of the remaining sets

  • index

    Returns a map of the distinct values of ks in the xrel mapped to a set of the maps in xrel with the corresponding valu...

  • intersection

    Return a set that is the intersection of the input sets

  • join

    When passed 2 rels, returns the rel corresponding to the natural join. When passed an additional keymap, joins on the ...

  • map-invert

    Returns the map with the vals mapped to the keys.

  • project

    Returns a rel of the elements of xrel with only the keys in ks

  • rename

    Returns a rel of the maps in xrel with the keys in kmap renamed to the vals in kmap

  • rename-keys

    Returns the map with the keys in kmap renamed to the vals in kmap

  • select

    Returns a set of the elements for which pred is true

  • subset?

    Is set1 a subset of set2?

  • superset?

    Is set1 a superset of set2?

  • union

    Return a set that is the union of the input sets

  • butlast

    Return a seq of all but the last item in coll, in linear time

  • cat

    A transducer which concatenates the contents of each input, which must be a collection, into the reduction.

  • concat

    Returns a lazy seq representing the concatenation of the elements in the supplied colls.

  • dedupe

    Returns a lazy sequence removing consecutive duplicates in coll. Returns a transducer when no collection is provided.

  • distinct

    Returns a lazy sequence of the elements of coll with duplicates removed. Returns a stateful transducer when no collect...

  • doall

    When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce ...

  • dorun

    When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce ...

  • doseq

    Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by "for". Does not ret...

  • drop

    Returns a laziness-preserving sequence of all but the first n items in coll. Returns a stateful transducer when no col...

  • drop-last

    Return a lazy sequence of all but the last n (default 1) items in coll

  • drop-while

    Returns a lazy sequence of the items in coll starting from the first item for which (pred item) returns logical false....

  • eduction

    Returns a reducible/iterable application of the transducers to the items in coll. Transducers are applied in order as ...

  • filter

    Returns a lazy sequence of the items in coll for which (pred item) returns logical true. pred must be free of side-eff...

  • filterv

    Returns a vector of the items in coll for which (pred item) returns logical true. pred must be free of side-effects.

  • flatten

    Takes any nested combination of sequential things (lists, vectors, etc.) and returns their contents as a single, flat ...

  • for

    List comprehension. Takes a vector of one or more binding-form/collection-expr pairs, each followed by zero or more ...

  • frequencies

    Returns a map from distinct items in coll to the number of times they appear.

  • group-by

    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...

  • interleave

    Returns a lazy seq of the first item in each coll, then the second etc.

  • interpose

    Returns a lazy seq of the elements of coll separated by sep. Returns a stateful transducer when no collection is provi...

  • into

    Returns a new coll consisting of to with all of the items of from conjoined. A transducer may be supplied. (into x) ...

  • keep

    Returns a lazy sequence of the non-nil results of (f item). Note, this means false return values will be included. f ...

  • keep-indexed

    Returns a lazy sequence of the non-nil results of (f index item). Note, this means false return values will be include...

  • map

    Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by app...

  • map-indexed

    Returns a lazy sequence consisting of the result of applying f to 0 and the first item of coll, followed by applying f...

  • mapcat

    Returns the result of applying concat to the result of applying map to f and colls. Thus function f should return a c...

  • mapv

    Returns a vector consisting of the result of applying f to the set of first items of each coll, followed by applying f...

  • merge

    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...

  • merge-with

    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...

  • nthnext

    Returns the nth next of coll, (seq coll) when n is 0.

  • nthrest

    Returns the nth rest of coll, coll when n is 0.

  • partition

    Returns a lazy sequence of lists of n items each, at offsets step apart. If step is not supplied, defaults to n, i.e. ...

  • partition-all

    Returns a lazy sequence of lists like partition, but may include partitions with fewer than n items at the end. Retur...

  • partition-by

    Applies f to each value in coll, splitting it each time f returns a new value. Returns a lazy seq of partitions. Re...

  • random-sample

    Returns items from coll with random probability of prob (0.0 - 1.0). Returns a transducer when no collection is provi...

  • reduce

    f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items i...

  • reduce-kv

    Reduces an associative collection. f should be a function of 3 arguments. Returns the result of applying f to init, th...

  • reductions

    Returns a lazy seq of the intermediate values of the reduction (as per reduce) of coll by f, starting with init.

  • remove

    Returns a lazy sequence of the items in coll for which (pred item) returns logical false. pred must be free of side-ef...

  • replace

    Given a map of replacement pairs and a vector/collection, returns a vector/seq with any elements = a key in smap repla...

  • reverse

    Returns a seq of the items in coll in reverse order. Not lazy.

  • rseq

    Returns, in constant time, a seq of the items in rev (which can be a vector or sorted-map), in reverse order. If rev i...

  • rsubseq

    sc must be a sorted collection, test(s) one of <, <=, > or >=. Returns a reverse seq of those entries with keys ek for...

  • run!

    Runs the supplied procedure (via reduce), for purposes of side effects, on successive items in the collection. Returns...

  • select-keys

    Returns a map containing only those entries in map whose key is in keys

  • shuffle

    Return a random permutation of coll

  • sort

    Returns a sorted sequence of the items in coll. If no comparator is supplied, uses compare. comparator must implement...

  • sort-by

    Returns a sorted sequence of the items in coll, where the sort order is determined by comparing (keyfn item). If no c...

  • split-at

    Returns a vector of [(take n coll) (drop n coll)]

  • split-with

    Returns a vector of [(take-while pred coll) (drop-while pred coll)]

  • subseq

    sc must be a sorted collection, test(s) one of <, <=, > or >=. Returns a seq of those entries with keys ek for which...

  • take

    Returns a lazy sequence of the first n items in coll, or all items if there are fewer than n. Returns a stateful tran...

  • take-last

    Returns a seq of the last n items in coll. Depending on the type of coll may be no better than linear time. For vect...

  • take-nth

    Returns a lazy seq of every nth item in coll. Returns a stateful transducer when no collection is provided.

  • take-while

    Returns a lazy sequence of successive items from coll while (pred item) returns logical true. pred must be free of sid...

  • transduce

    reduce with a transformation of f (xf). If init is not supplied, (f) will be called to produce it. f should be a reduc...

  • tree-seq

    Returns a lazy sequence of the nodes in a tree, via a depth-first walk. branch? must be a fn of one arg that returns ...

  • update-keys

    m f => {(f k) v ...} Given a map m and a function f of 1-argument, returns a new map whose keys are the result of a...

  • update-vals

    m f => {k (f v) ...} Given a map m and a function f of 1-argument, returns a new map where the keys of m are mapped...

  • xml-seq

    A tree seq on the xml elements as per xml/parse

  • assoc!

    When applied to a transient map, adds mapping of key(s) to val(s). When applied to a transient vector, sets the val at...

  • conj!

    Adds x to the transient collection, and return coll. The 'addition' may happen at different 'places' depending on the ...

  • disj!

    disj[oin]. Returns a transient set of the same (hashed/sorted) type, that does not contain key(s).

  • dissoc!

    Returns a transient map that doesn't contain a mapping for key(s).

  • persistent!

    Returns a new, persistent version of the transient collection, in constant time. The transient collection cannot be us...

  • pop!

    Removes the last item from a transient vector. If the collection is empty, throws an exception. Returns coll

  • transient

    Returns a new, transient version of the collection, in constant time. Transients support a parallel set of 'changing'...