Hi huys: I want to display "average" for all values โโon the map. I have a list of maps:
[{"age" 2 "height" 1 "weight" 10},
{"age" 4 "height" 4 "weight" 20},
{"age" 7 "height" 11 "weight" 40}]
And my desired result
{"age 5 "height" 5 ....}
/// The following are the breaks of my brain, that is, the way I can imagine that this works in Clojure ... is not taken too seriously
transpose the list:
{"age" [2 4 7] "height" [1 4 11] }
and then I could just do something like (again, by creating a function called freduce here)
(freduce average (vals (map key-join list)))
To obtain
{"age" 5 "weight" 10 "height" 7}
source
share