Hello,

I just came across with this question on the exam and can not think of
implementing it.

mapPair :: (a -> a -> a) -> [a] -> [a]

such that mapPairs f [x1, x2, x3, x4...] = [f x1 x2, f x3 x4,...]

and if the list contains an odd number of elements, the last one is kept
unchanged, for example

mapPairs f [x1, x2, x3] = [f x1 x2, x3]


Any ideas will be appreciated, thanks
-- 
View this message in context: 
http://www.nabble.com/defining-mapPairs-function-tf4350356.html#a12395628
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to