Just finished juxt. It's one of my favorites. Perhaps my favorite use is computing the coordinates on a unit circle given an input in radians:
(def unit-coordinates (juxt #(Math/cos %) #(Math/sin %)))
I hadn't thought of using juxt for map-vals before:
(defn map-vals [f m]
(->> m
(map (juxt key (comp f val)))
(into (empty m))))
(map-vals inc {:a 1 :b 2})
=> {:a 2, :b 3}
I've always used zipmap but that breaks up your thread-last form. This allows you to keep the thread rolling. Cool!I see myself using the latter more. The former is cool, but I don't finding myself doing geometry as much as I'd like.