Fork me on GitHub
#clojuredesign-podcast
<
2020-07-17
>
Drew Verlee00:07:37

Wouldn't reduce be more clear? (reduce-kv (fn [m k v] (assoc m k (inc v))) {} {:a 1 :b 2}) I guess it's also not typical that I would want all my keys Val's updated at the same time.

nate01:07:30

I've found that the "map reformer" as we've been calling it on the podcast is the clearest.

(into {} (map (juxt key (comp inc val))) m)

nate01:07:21

Pulling it into a function (like map-vals) is an interesting abstraction

nate01:07:58

I find myself just in-lining the (into ...) as it's short enough and reads like what it does

nate02:07:38

I also agree with you @markbastian. The way they talked about it in middle school sounded like I would be doing a lot more geometry than I do now. simple_smile

nate02:07:52

but it's a cool example, nevertheless