I don’t know how it’s usually called, but what I need is something like this:
f a b c = a + 2 * b + 3 * c
map f [(1,2,3), (4,5,6), (7,8,9)]
i.e. mapping list of n-tuples to a function with n separate arguments. Is there a built-in way to do this in Haskell?
P.S.: I’ve found uncurry just now, but it doesn’t seem to work this way with 3 arguments, only with 2.
You can define your own function:
Alternatively, you can use
uncurryNfrom thetuplepackage which works for tuple sizes up to 15: