
9 Feb
2005
9 Feb
'05
7:32 p.m.
On Wed, Feb 09, 2005 at 08:47:43PM +0100, Tomasz Zielonka wrote:
On Wed, Feb 09, 2005 at 11:50:48AM -0000, Simon Marlow wrote:
sortBy (comparing fst)
is just too cute not to have. Any objections?
How about a more general function:
composeFGxGy :: (b -> b -> c) -> (a -> b) -> a -> a -> c composeFGxGy f g x y = f (g x) (g y)
I agree, though I don't like its name ;) Mike just called it `onField', and I've seen it as `on' before. sortBy (compare `on` fst) groupBy ((==) `on` toLower) zipWith ((*) `on` fst) Having both `comparing' and `equaling' seems overkill, and just `on' is just as usable IMO. (No, I never used that last one.) Greetings, Remi -- Nobody can be exactly like me. Even I have trouble doing it.