Map helpers.
Map helpers.
(assoc-all map keys value)
Assocs all keys of a given list with the provided value. E.g.:
(assoc-all {} [:a :b] 1)
Will produce: {:a 1 :b 1}
Assocs all keys of a given list with the provided value. E.g.: (assoc-all {} [:a :b] 1) Will produce: {:a 1 :b 1}
(assoc-all-if map condition keys value)
Assocs all keys with the provided value if the given condition is true.
Assocs all keys with the provided value if the given condition is true.
(assoc-if map condition key value)
Assocs a key-value pair to the map if the given condition is true.
A condition function can be provided as condition, as the following example:
(assoc-if {:a 0} #(>= % 0) :b 3)
Will produce: {:a 0 :b 3}, since the given value 3 is >= 0.
Assocs a key-value pair to the map if the given condition is true. A condition function can be provided as condition, as the following example: (assoc-if {:a 0} #(>= % 0) :b 3) Will produce: {:a 0 :b 3}, since the given value 3 is >= 0.
(dissoc-all map keys)
Dissocs all keys of a given list. E.g.:
(dissoc-all {:a 1 :b 2} [:a])
Will produce: {:b 2}
Dissocs all keys of a given list. E.g.: (dissoc-all {:a 1 :b 2} [:a]) Will produce: {:b 2}
(dissoc-all-if map condition keys)
Assocs all keys with the provided value if the given condition is true.
Assocs all keys with the provided value if the given condition is true.
(dissoc-if map condition key)
Dissocs a key-value pair from the map if the given condition is true.
A condition function can be provided as condition, as the following example:
(dissoc-if {:a 0 :b 1} #(<= % 0) :a)
Will produce: {:b 1}, since :a's value is <= 0.
Dissocs a key-value pair from the map if the given condition is true. A condition function can be provided as condition, as the following example: (dissoc-if {:a 0 :b 1} #(<= % 0) :a) Will produce: {:b 1}, since :a's value is <= 0.
(merge-maps map-a map-b)
Merges map-a replacing and appending values from map-b.
Merges map-a replacing and appending values from map-b.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close