If we have a list of functions [f1,...fn]
and a list of parameters [a1,...,an]
, is there a simple way (in Haskell) to produce something like [fn a1, ..., fn an]
? I have been looking and only found a function called sequenceA
, but it returns all posible matchings, and in the case I'm considering each f is only necessarily defined for the corresponding parameter. Thanks.
Asked
Active
Viewed 47 times
1

monalisa
- 19
- 4
1 Answers
3
What you want is zipWith
:
zipWith ($) fs xs -- fs is the list of functions, xs is the list of values
Simple simon. Hope that helps.

Aadit M Shah
- 72,912
- 30
- 168
- 299
-
So simple! Thank you! – monalisa Sep 19 '15 at 03:15