I am trying to name what I think is a new idea for a higher-order function. To the important part, here is the code in Python and Haskell to demonstrate the concept, which will
So because there seems to be no name for this I suggest 'merger' or simple 'merge' because you are merging adjacent values together.
So merge is already taken so I now suggest 'meld' (or 'merger' still but that may be too close to 'merge')
For example:
meld :: (a -> a -> b) -> [a] -> [b]
meld _ [] = []
meld f xs = zipWith f (init xs) (tail xs)
Which can be used as:
> meld (+) [1..10]
[3,5,7,9,11,13,15,17,19]
> meld compare "hello world"
[GT,LT,EQ,LT,GT,LT,GT,LT,GT,GT]
Where the second example makes no real sense but makes a cool example.