In an attempt to learn better functional programing I've attempted to convert some Python to idiomatic Clojure, but I'm not sure how well I did with parts of it.
One thing I found myself doing a lot was destructuring a map into a list and then converting it back into a map as in the following example that takes a map of products and ratings (e.g. {:m1 3.5 :m2 2}
) and a multiplier and multiplies each rating by the multiplier and returns a map with the corresponding products.
(defn corrected-prod [person multiplyer]
(into {} (map (fn [[k v]] [k (* v multiplyer)]) person)))
Is there a better way to do this? For context you can reference the code on GitHub.