I would like to use the map function on map. But I can't get it to work.
A toy example:
(map map [+ - *] [1 2 3] [4 5 6] [7 8 9])
I expect a result like (12 15 18) but all I get is an error.
Thanks.
As an alternative to already existing answers, you could replace the outer map
with a list comprehension, which is more readable than a nested map
IMHO:
user=> (defn fun [ops & args]
#_=> (for [op ops]
#_=> (apply map op args)))
#'user/fun
user=> (fun [+ - *] [1 2 3] [4 5 6] [7 8 9])
((12 15 18) (-10 -11 -12) (28 80 162))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With