--I can't seem to use map to get the sum of the numbers in the tuples. How would you combine map with zip?zip' :: [a] -> [b] -> [(a,b)]zip' _ [] = []zip' [] _ = []zip' (x:xs) (y:ys) = (x, y):zip' xs yswhere map (\(x,y) -> x + y)
You received this message because you are subscribed to the Google Groups "haskell-exercises" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haskell-exercises+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I'm working with two lists so an example could be [4,5,6,7] [8,6,4,5] and when we use zip' we will get [(4,8), (5,6), (6,4), (7,5)] then I want to use map that sums the number of each tuple which in this case would be [12,11,10,12]. I just don't understand how to combine map into the zip' function.
On Thursday, November 2, 2017 at 3:33:10 PM UTC-7, David Tchepak wrote:
Can you clarify what you're trying to do?Do you want to transform [(1,2), (3,4)] to [3, 7] ? Or are you working with two lists?
On Fri, Nov 3, 2017 at 3:24 AM, Mirasol Davila <mirasol...@gmail.com> wrote:
I can't seem to use map to get the sum of the numbers in the tuples. How would you combine map with zip?zip' :: [a] -> [b] -> [(a,b)]zip' _ [] = []zip' [] _ = []zip' (x:xs) (y:ys) = (x, y):zip' xs yswhere map (\(x,y) -> x + y)
--
You received this message because you are subscribed to the Google Groups "haskell-exercises" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haskell-exerci...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I'm working with two lists so an example could be [4,5,6,7] [8,6,4,5] and when we use zip' we will get [(4,8), (5,6), (6,4), (7,5)] then I want to use map that sums the number of each tuple which in this case would be [12,11,10,12]. I just don't understand how to combine map into the zip' function.
On Thursday, November 2, 2017 at 3:33:10 PM UTC-7, David Tchepak wrote:
Can you clarify what you're trying to do?Do you want to transform [(1,2), (3,4)] to [3, 7] ? Or are you working with two lists?
On Fri, Nov 3, 2017 at 3:24 AM, Mirasol Davila <mirasol...@gmail.com> wrote:
I can't seem to use map to get the sum of the numbers in the tuples. How would you combine map with zip?zip' :: [a] -> [b] -> [(a,b)]zip' _ [] = []zip' [] _ = []zip' (x:xs) (y:ys) = (x, y):zip' xs yswhere map (\(x,y) -> x + y)
--
You received this message because you are subscribed to the Google Groups "haskell-exercises" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haskell-exerci...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.