I have 2 lists:
[[1,2],[4,5]]
and
[0, 3]
and I’d like to turn it into
[[0,1,2],[3,4,5]]
I’ve created a function that does just that:
myFun xxs xs = map (\x -> (fst x):(snd x)) (zip xs xxs)
and it works. But I am still left wondering whether there might exist a better way to accomplish this without using the zip. Is there any?
Basically what I want to do is iterate along the 2 lists at the same time, something that I can’t think of a way to do in Haskell without resorting to zip.
Thanks
Use zipWith. For example:
Gives: