(no title)
pmapcat | 4 years ago
(update-fn (fn [{:keys [address]}
:as customer]
(if address (update customer :address clojure.string/capitalize) customer))
customers)
which pattern matches on some `object` (map) and does processing. We find it less fragile than specifying explicit path to an element. It can also work in a polymorphic fashion. On the other hand, there is a risk of a false positive (when you modify address that you shouldn't). But you can mitigate that risk by using additional checks (in case of a customer, you can check for additional set of fields that are specific for that object(map)
edit:formatting
No comments yet.