[Haskell-cafe] Does somebody know about these functions?
byorgey at seas.upenn.edu
Tue Feb 28 19:25:31 CET 2012
On Tue, Feb 28, 2012 at 06:06:25PM +0100, Johan Holmquist wrote:
> inter :: (a -> a -> b) -> [a] -> [b]
> inter f  = 
> inter f l = map (uncurry f) $ zip l (tail l)
I've never seen this function defined anywhere, but it looks nice.
> withPair :: (a' -> b' -> c) -> (a -> a') -> (b -> b') -> (a,b) -> c
> withPair f fa fb (a,b) = fa a `f` fb b
withPair f g h === uncurry f . (g *** h)
although using withPair is probably nicer (it certainly involves fewer
More information about the Haskell-Cafe