Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to map a function with several arguments

Tags:

haskell

Suppose I have a function definition like this:

f x y z = ...

Now I have a list of each of the argument: [x],[y],[z]

How do I somehow map f over all the corresponding element in each list? That is, i want only the first element(or the second, third, but not with different positions) from all the lists to be applied to the function. For example:

f x1 y1 z1
f x2 y2 z2

but not

f x1 y2 z3 etc
like image 451
McBear Holden Avatar asked Jun 04 '26 13:06

McBear Holden


1 Answers

I think you want the Prelude function zipWith3

like image 124
RobertDiep Avatar answered Jun 08 '26 00:06

RobertDiep



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!