
3 Apr
2006
3 Apr
'06
5:53 a.m.
On Sun, 02 Apr 2006, "Jared Updike"
Something like "distribute fst (==)" where
distribute f op x y = f x `op` f y
A function like this has been suggested for the standard libraries a couple of times before. Someone suggested the name "on", which I quite like: (*) `on` f = \x y -> f x * f y
unionBy (distribute fst (==)) listOfPairs1 listOfPairs2
unionBy ((==) `on` fst) xs ys I think on makes the code rather readable: union by equality on first. -- /NAD