Collections
assoc
(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).
concat
(concat) (concat x) (concat x y) (concat x y & zs)
Returns a sequence representing the concatenation of the elements in the supplied colls.
conj
(conj coll x) (conj coll x & xs)
conj[oin]. Returns a new collection with the xs 'added'. The 'addition' may happen at different 'places' depending on the concrete type of coll.
cons
Constructs a list recursively using the pattern (cons element rest-of-list)
.
contains?
Checks whether a hashmap contains a record with the given key. Given key can be either a string or a keyword.
count
Counts the number of elements in a coll.
dissoc
(dissoc map) (dissoc map key) (dissoc map key & ks)
empty?
Checks whether coll has no elements.
get
(get map key) (get map key not-found)
Returns the value mapped to key, not-found or nil if key not present.
first
Returns the first item in the collection. If coll is nil, returns nil.
keys
Gets a list of all the keys from a hashmap.
list
Creates a new list containing the items.
hash-map
(hash-map) (hash-map & keyvals)
Returns a new hash map with supplied mappings. If any keys are
equal, they are handled as if by repeated uses of assoc.
map
Returns a sequence consisting of the result of applying f to
the first item of coll, followed by applying f to the second item of coll, until coll is exhausted.
nth
Returns the value at the index of coll.
rest
Returns a possibly empty sequence of the items after the first.
reverse
Returns a sequence of the items in coll in reverse order.
seq
Returns a sequence on the collection. If the collection is empty, returns nil. (seq nil) returns nil. seq
also works on Strings.
vals
Returns a sequence of the map's values.
vector
(vector) (vector a) (vector a b) (vector a b c) (vector a b c d) (vector a b c d e) (vector a b c d e f) (vector a b c d e f & args)
Creates a new vector containing the args.