Hi Alexteslin,

> 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,...]

I would implement this using direct recursion. As a starting point,
the standard definition of map is:

map f [] = []
map f (x:xs) = f x : map f xs

You should be able to start at this and modify it to give the
behaviour you require.

If you want further hints, you might want to try the Haskell IRC
Channel, which is good for these kind of questions.
http://www.haskell.org/haskellwiki/IRC_channel

Thanks

Neil
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to