(assoc-if p m k v)
(assoc-if p m k v & more)
Assoc key/value pairs for some predicate on key-value values
(assoc-if #(< (count (str %1 %2)) 5) {} :a 1 :b 2) => {:a 1 :b 2} (assoc-if #(< (count (str %1 %2)) 5) {} :waytoolong 1 :b 2) => {:b 2}
Assoc key/value pairs for some predicate on key-value values (assoc-if #(< (count (str %1 %2)) 5) {} :a 1 :b 2) => {:a 1 :b 2} (assoc-if #(< (count (str %1 %2)) 5) {} :waytoolong 1 :b 2) => {:b 2}
Assoc key/value pairs for non-nil values
(assoc-some {} :a 1 :b nil :c 3) => {:a 1 :c 3}
Assoc key/value pairs for non-nil values (assoc-some {} :a 1 :b nil :c 3) => {:a 1 :c 3}
(deep-merge-with f & maps)
Like merge-with, but merges maps recursively, appling the given fn only when there's 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, appling the given fn only when there's 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}
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close