map -package:Cabal -package:base -package:text -package:pipes -package:containers -package:unordered-containers -package:conduit package:utility-ht

This function combines every pair of neighbour elements in a list with a certain function.
>>> mapAdjacent (<=) ""
[]

>>> mapAdjacent (<=) "a"
[]

>>> mapAdjacent (<=) "aba"
[True,False]

>>> mapAdjacent (,) "abc"
[('a','b'),('b','c')]
\x xs -> mapAdjacent subtract (scanl (+) x xs) == (xs::[Integer])
>>> let f x y z = [x,y]++show(z::Int) in mapAdjacent1 f 'a' [('b',1), ('c',2), ('d',3)]
["ab1","bc2","cd3"]
Cf. (***). Apply two functions on corresponding values in a pair, where the pattern match on the pair constructor is lazy. This is crucial in recursions such as the one of partition. One the other hand there are applications where strict application is crucial, e.g. mapSnd f ab where the left pair member is a large lazy list. With the lazy mapSnd we make the application of f depend on the whole pair ab. See Data.Tuple.Example for two examples where one variant is definitely better than the other one.