Closed frankschmitt closed 6 years ago
I just noticed that lift2
seems to be exactly what I'm looking for (from the docs ):
lift2 : (a -> b -> c) -> List a -> List b -> List c
Map functions taking multiple arguments over multiple lists, regardless of list length. All possible combinations will be explored.
lift2 (+) [1,2,3][4,5] == [5,6,6,7,7,8]
Sorry for the noise, Frank
I believe you are actually looking for List.map2
. List.Extra.lift2
is slightly different in that it explores all of the possible pairs, sort of like a Cartesian product.
You're right - List.map2 is what I was looking for, thanks.
Hello all,
I'd like to suggest an addtional function zipWith(). It should work exactly like its Haskell counterpart:
Implementation should be pretty straightforward - I can provide one if required (but I wanted to ask here first before submitting a pull request).
Kind regards, Frank