Liking cljdoc? Tell your friends :D

flatland.useful.map


assoc-in!clj

(assoc-in! m 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. The associative structure can have transients in it, but if any levels do not exist, non-transient 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. The associative structure
can have transients in it, but if any levels do not exist, non-transient hash-maps will
be created.
sourceraw docstring

assoc-in*clj

(assoc-in* m keys 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. This implementation was adapted from clojure.core, but the behavior is more correct if keys is empty.

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. This implementation was adapted from clojure.core, but the behavior is more correct if
keys is empty.
sourceraw docstring

assoc-orclj

(assoc-or m key val)
(assoc-or m key val & kvs)

Create mapping from each key to val in map only if existing val is nil.

Create mapping from each key to val in map only if existing val is nil.
sourceraw docstring

dissoc-in*clj

(dissoc-in* m keys)

Dissociates a value in a nested associative structure, where ks is a sequence of keys and returns a new nested structure. If any resulting maps are empty, they will be removed from the new structure. This implementation was adapted from clojure.core.contrib, but the behavior is more correct if keys is empty.

Dissociates a value in a nested associative structure, where ks is a sequence of keys and returns
a new nested structure. If any resulting maps are empty, they will be removed from the new
structure. This implementation was adapted from clojure.core.contrib, but the behavior is more
correct if keys is empty.
sourceraw docstring

filter-keysclj

(filter-keys m pred)

Returns a map that only contains keys where (pred key) returns true.

Returns a map that only contains keys where (pred key) returns true.
sourceraw docstring

filter-keys-by-valclj

(filter-keys-by-val pred m)

Returns all keys in map for which (pred value) returns true.

Returns all keys in map for which (pred value) returns true.
sourceraw docstring

filter-valsclj

(filter-vals m pred)
source

index-byclj

(index-by f coll)

Returns a map from the result of calling f on each item in coll to that item.

Returns a map from the result of calling f on each item in coll to that item.
sourceraw docstring

into-mapclj

(into-map & args)

Convert a list of heterogeneous args into a map. Args can be alternating keys and values, maps of keys to values or collections of alternating keys and values. If the first arg is a function, it will be used for merging duplicate values.

Convert a list of heterogeneous args into a map. Args can be alternating keys and values,
maps of keys to values or collections of alternating keys and values. If the first arg is
a function, it will be used for merging duplicate values.
sourceraw docstring

keyedcljmacro

(keyed vars)
(keyed key-type vars)

Create a map in which, for each symbol S in vars, (keyword S) is a key mapping to the value of S in the current scope. If passed an optional :strs or :syms first argument, use strings or symbols as the keys instead.

Create a map in which, for each symbol S in vars, (keyword S) is a
key mapping to the value of S in the current scope. If passed an optional
:strs or :syms first argument, use strings or symbols as the keys instead.
sourceraw docstring

map-keysclj

(map-keys m f & args)

Create a new map from m by calling function f on each key to get a new key.

Create a new map from m by calling function f on each key to get a new key.
sourceraw docstring

map-keys-and-valsclj

(map-keys-and-vals m f & args)

Create a new map from m by calling function f on each key & each value to get a new key & value

Create a new map from m by calling function f on each key & each value to get a new key & value
sourceraw docstring

map-toclj

(map-to f coll)

Returns a map from each item in coll to f applied to that item.

Returns a map from each item in coll to f applied to that item.
sourceraw docstring

map-valsclj

(map-vals m f & args)

Create a new map from m by calling function f on each value to get a new value.

Create a new map from m by calling function f on each value to get a new value.
sourceraw docstring

map-vals-with-keysclj

(map-vals-with-keys m f & args)

Create a new map from m by calling function f, with two arguments (the key and value) to get a new value.

Create a new map from m by calling function f, with two arguments (the key and value)
to get a new value.
sourceraw docstring

merge-inclj

(merge-in & args)

Merge multiple nested maps.

Merge multiple nested maps.
sourceraw docstring

multi-mapclj

(multi-map m)

Takes a map with keys and values that can be sets or individual objects and returns a map from objects to sets. Used to create associations between two sets of objects.

Takes a map with keys and values that can be sets or individual objects and returns a map from
objects to sets. Used to create associations between two sets of objects.
sourceraw docstring

ordering-mapclj

(ordering-map key-order)
(ordering-map key-order default-comparator)

Create an empty map with a custom comparator that puts the given keys first, in the order specified. Other keys will be placed after the special keys, sorted by the default-comparator.

Create an empty map with a custom comparator that puts the given keys first, in the order
specified. Other keys will be placed after the special keys, sorted by the default-comparator.
sourceraw docstring

positionclj

(position coll)

Returns a map from item to the position of its first occurence in coll.

Returns a map from item to the position of its first occurence in coll.
sourceraw docstring

remove-keysclj

(remove-keys m pred)

Returns a map that only contains keys where (pred key) returns false.

Returns a map that only contains keys where (pred key) returns false.
sourceraw docstring

remove-keys-by-valclj

(remove-keys-by-val pred m)

Returns all keys of map for which (pred value) returns false.

Returns all keys of map for which (pred value) returns false.
sourceraw docstring

remove-valsclj

(remove-vals m pred)

Returns a map that only contains values where (pred value) returns false.

Returns a map that only contains values where (pred value) returns false.
sourceraw docstring

updateclj

(update m key f & args)

Update a value for the given key in a map where f is a function that takes the previous value and the supplied args and returns the new value. Like update-in*, unchanged values are not re-assoc'd.

Update a value for the given key in a map where f is a function that takes the previous value and
the supplied args and returns the new value. Like update-in*, unchanged values are not
re-assoc'd.
sourceraw docstring

update-eachclj

(update-each m keys f & args)

Update the values for each of the given keys in a map where f is a function that takes each previous value and the supplied args and returns a new value. Like update-in*, unchanged values are not re-assoc'd.

Update the values for each of the given keys in a map where f is a function that takes each
previous value and the supplied args and returns a new value. Like update-in*, unchanged values
are not re-assoc'd.
sourceraw docstring

update-in!clj

(update-in! m [k & 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. The associative structure can have transients in it, but if any levels do not exist, non-transient 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. The associative structure can have transients
in it, but if any levels do not exist, non-transient hash-maps will be created.
sourceraw docstring

update-in*clj

(update-in* m keys 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. This implementation was adapted from clojure.core, but the behavior is more correct if keys is empty and unchanged values are not re-assoc'd.

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. This implementation
was adapted from clojure.core, but the behavior is more correct if keys is empty and unchanged
values are not re-assoc'd.
sourceraw docstring

update-withinclj

(update-within m keyseq f & args)

Like update-in*, but don't call f at all unless the map contains something at the given keyseq.

Like update-in*, but don't call f at all unless the map contains something at the given keyseq.
sourceraw docstring

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

× close