Liking cljdoc? Tell your friends :D

utilis.map


assoc-ifclj/s

(assoc-if map key val)
(assoc-if map key val pred)

Conditionally assoc val into map at key if val passes the test specified by the optional pred. If pred is not specified, the val is tested for truthiness.

Conditionally assoc `val` into `map` at `key` if `val` passes the test
specified by the optional `pred`. If `pred` is not specified, the val is
tested for truthiness.
raw docstring

assoc-in-ifclj/s

(assoc-in-if map keys val)
(assoc-in-if map keys val pred)

Conditionally assoc-in val into map at keys if val passes the test specified by the optional pred. If pred is not specified, the val is tested for truthiness.

Conditionally assoc-in `val` into `map` at `keys` if `val` passes the test
specified by the optional `pred`. If `pred` is not specified, the val is
tested for truthiness.
raw docstring

compactclj/s

(compact m)

Returns 'm' with all the keys that have nil or empty values removed. If the act of compaction results in all keys being removed a nil is returned.

The compaction is recursive, e.g., (compact {:a {:b [{} {:c {}}]}}) => nil

Returns 'm' with all the keys that have nil or empty values removed.
If the act of compaction results in all keys being removed a nil is
returned.

The compaction is recursive, e.g.,
  (compact {:a {:b [{} {:c {}}]}}) => nil
raw docstring

deep-mergeclj/s

(deep-merge & maps)

Like merge, but merges 'maps' recursively.

Like merge, but merges 'maps' recursively.
raw docstring

deep-merge-withclj/s

(deep-merge-with f & maps)

Like merge-with, but merges 'maps' recursively, applying 'f' only when there is a non-map at a particular level. (deep-merge-with + {:a {:b {:c 1 :d {:x 1 :y 2}} :e 3} :f 4} {:a {:b {:c 2 :d {:z 9} :z 3} :e 100}}) => {:a {:b {:z 3, :c 3, :d {:z 9, :x 1, :y 2}}, :e 103}, :f 4}

Like merge-with, but merges 'maps' recursively, applying 'f'
only when there is a non-map at a particular level.
  (deep-merge-with + {:a {:b {:c 1 :d {:x 1 :y 2}} :e 3} :f 4}
                     {:a {:b {:c 2 :d {:z 9} :z 3} :e 100}})
  => {:a {:b {:z 3, :c 3, :d {:z 9, :x 1, :y 2}}, :e 103}, :f 4}
raw docstring

filter-valsclj/s

(filter-vals pred m)

Return a map with the keys and values from 'm' for which 'pred' returned a truthy result for the value.

Return a map with the keys and values from 'm' for which 'pred'
returned a truthy result for the value.
raw docstring

key-pathsclj/s

(key-paths m)
(key-paths m prefix)

Computes all nested key paths in a map.

Computes all nested key paths in a map.
raw docstring

map-keysclj/s

(map-keys f m)

Apply the provided function 'f' to each key in map 'm'.

Apply the provided function 'f' to each key in map 'm'.
raw docstring

map-valsclj/s

(map-vals f m)

Apply the provided function 'f' to each value in map 'm'.

Apply the provided function 'f' to each value in map 'm'.
raw docstring

remove-valsclj/s

(remove-vals pred m)

Returns a map with the keys and values from 'm' with the keys and values for which 'pred' returned a truthy result removed.

Returns a map with the keys and values from 'm' with the keys and
values for which 'pred' returned a truthy result removed.
raw docstring

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

× close