[Haskell-cafe] Is this a useful higher-order function, or should I RTFM?

Steven Huwig shuwig at columbus.rr.com
Tue Dec 7 20:29:46 EST 2004


On Dec 6, 2004, at 11:05 PM, Tom Pledger wrote:
>    import Data.Char(isSpace)
>    import Data.List(groupBy)
>
>    (op `on` f) x y = f x `op` f y
>    wordsAndSpaces  = groupBy ((==) `on` isSpace)
>

`on` is a handy little function in this instance.

Does it have a technical name?
Have you used it elsewhere?


-- Steve



More information about the Haskell-Cafe mailing list