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
Here's another implementation for Python which works if l is a generator too
l
import itertools as it def apply_pairwise(f, l): left, right = it.tee(l) next(right) return it.starmap(f, it.izip(left, right))
I think apply_pairwise is a better name
apply_pairwise