Liking cljdoc? Tell your friends :D

automaton-core.utils.map

Utility for map data structure

Utility for map data structure
raw docstring

add-idsclj/s

(add-ids m)

Add the key to all map values (which are expected to be maps).

Add the key to all map values (which are expected to be maps).
raw docstring

apply-to-keysclj/s

(apply-to-keys maps f & ks)

Apply function f to each key in ks in the maps in maps Params:

  • f fn with three arguments. First is k the key currently update (one of ks), second is m the current value of the m while it is updated, third is v the current value of key k in map m
  • maps is a sequence of map
  • ks keys in the map to apply f to
Apply function `f` to each key in `ks` in the maps in `maps`
Params:
* `f` fn with three arguments. First is `k` the key currently update (one of `ks`), second is `m` the current value of the m while it is updated, third is `v` the current value of key `k` in map `m`
* `maps` is a sequence of map
* `ks` keys in the map to apply `f` to
raw docstring

crushclj/s

(crush m)

Crush the map

Crush the map
raw docstring

deep-mergeclj/s

(deep-merge & maps)

Deep merge nested maps. Last map has higher priority

This code comes from this gist

Deep merge nested maps.
Last map has higher priority

This code comes from this [gist](https://gist.github.com/danielpcox/c70a8aa2c36766200a95)
raw docstring

get-key-or-afterclj/s

(get-key-or-after m n)

Returns the key if it exists in the sorted-map

Note this is not an efficient way

Params:

  • m the sorted map
  • n
Returns the key if it exists in the sorted-map

Note this is not an efficient way

Params:
* `m` the sorted map
* `n`
raw docstring

get-key-or-beforeclj/s

(get-key-or-before m n)

Returns the key if it exists in the sorted-map

Note this is not an efficient way

Params:

  • m the sorted map
  • n
Returns the key if it exists in the sorted-map

Note this is not an efficient way

Params:
* `m` the sorted map
* `n`
raw docstring

idx-ofclj/s

(idx-of v value)

Return the index of the first found value in the sequence

Return the index of the first found value in the sequence
raw docstring

idx-of-predclj/s

(idx-of-pred v pred)

Same as idx-of but with a predicate

Same as idx-of but with a predicate
raw docstring

keys->sequence-numberclj/s

(keys->sequence-number m)

Return a map associating a key of the map m with a number, numbered from 1 to n.

Return a map associating a key of the map `m` with a number, numbered from 1 to n.
raw docstring

map-differenceclj/s

(map-difference m1 m2)

map-util-hashmappify-valsclj/s

(map-util-hashmappify-vals m modify-type-fn)

Converts an ordinary Clojure map into a Clojure map with nested map values recursively translated into what modify-type-fn is returning. Based on walk/stringify-keys. When key or value is nil, the pair is removed, as the hashmap doesn't allow null keys/values.

Converts an ordinary Clojure map into a Clojure map with nested map
values recursively translated into what modify-type-fn is returning. Based
on walk/stringify-keys.
When key or value is nil, the pair is removed, as the hashmap doesn't allow null keys/values.
raw docstring

maps-to-keyclj/s

(maps-to-key maps k)

maps is a list of map which value matching key k is used as a key to store the map as a value.

`maps` is a list of map which value matching key `k` is used as a key to store the map as a value.
raw docstring

prefixify-childrenclj/s

(prefixify-children thing)

prefixify-mapclj/s

(prefixify-map prefix thing)

prefixify-vecclj/s

(prefixify-vec prefix thing)

remove-nil-submap-valsclj/s

(remove-nil-submap-vals m)

remove-nil-valsclj/s

(remove-nil-vals m)

replace-keysclj/s

(replace-keys m1 m2)

Replace keys in m2 with keys from m1. Similiar to merge but non-existen keys in first map won't be added. e.g. (replace-keys {:a 3 :b 2} {:a 1}) -> {:a 3}

Replace keys in `m2` with keys from `m1`. Similiar to merge but non-existen keys in first map won't be added. e.g. (replace-keys {:a 3 :b 2} {:a 1}) -> {:a 3}
raw docstring

submap?clj/s

(submap? sub m)

Is sub existing in m?

Is `sub` existing in `m`?
raw docstring

translate-keysclj/s

(translate-keys m translation)

Translate keys of map m thanks to the translation.

Translate keys of map `m` thanks to the `translation`.
raw docstring

translate-valsclj/s

(translate-vals m translation)

Translate vals of map m thanks to the translation.

Translate vals of map `m` thanks to the `translation`.
raw docstring

update-kwclj/s

(update-kw m kws f)

Update the keywords kws in map m with function f

Update the keywords `kws` in map `m` with function `f`
raw docstring

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

× close