[Haskell-cafe] List manipulation
mailing-lists at dapissarenko.com
Wed Jan 26 11:39:42 EST 2005
I have two lists of Double with equal length and want to create a third one,
in which each element is the sum of the corresponding element of the first
list and the second list.
If list1 is [1, 2, 100] and list2 is [2, 3, 500], then the result of the
operation I desire is [3, 5, 600].
I wrote this function
add2Img :: [Double] -> [Double] -> [Double]
add2Img summand1 summand2 = sum
where sum = [ (x+y) | x <- summand1, y <- summand2 ]
but I'm getting
[1, 2, 100].
What is wrong with the function above?
More information about the Haskell-Cafe