clojure.core/update¶
'Updates' a value in an associative structure, where k is a key and f is a function that will take the old value and any supplied args and return the new value, and returns a new structure. If the key does not exist, nil is passed as the old value.
Examples¶
Note by alper¶
But how do you do a pure update idiomatically? So update one value for another?
Note by Crowbrammer¶
To the previous note (alper), you are looking for assoc.
Note by earthfail¶
in clojure 1.11 there is an update-vals and update-keys to apply function for all values or all keys respectively
See also¶
Content from the matching ClojureDocs page, with authors credited on each contribution.