(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.
(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
(deep-merge & maps)
Like merge, but merges 'maps' recursively.
Like merge, but merges 'maps' recursively.
(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}
(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.
(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'.
(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'.
(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.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close