
13 Apr
2016
13 Apr
'16
4:23 a.m.
On 2016-04-12 22:55, Johan Holmquist wrote:
I propose adding two new functions to Data.List:
zipConsecutives :: [a] -> [(a,a)] zipConsecutives xs = zip xs (tail xs)
zipConsecutivesWith :: (a -> a -> b) -> [a] -> [b] zipConsecutivesWith f xs = zipWith f xs (tail xs)
(with possibly more efficient implementations)
For what it's worth, the function for combining adjacent elements is sometimes called 'pairwise' in Python, maybe based on this list of recipes: https://docs.python.org/2/library/itertools.html#recipes Maybe that's a viable naming alternative? -- Frerich Raabe - raabe@froglogic.com www.froglogic.com - Multi-Platform GUI Testing