
2 Apr
2006
2 Apr
'06
2:58 p.m.
Is there a common way (standard libs, higher order) to express the lambda part below? It's not particulary complicated but I think it is not higher-order enough
unionBy (\x y -> fst x == fst y) listOfPairs1 listOfPairs2
Something like "distribute fst (==)" where
distribute f op x y = f x `op` f y
would leave
unionBy (distribute fst (==)) listOfPairs1 listOfPairs2
I imagine something involving Arrows and/or zip/curry/uncurry but I just can't see it. Is this a case of trying to make something more complicated than it is? Jared. -- http://www.updike.org/~jared/ reverse ")-:"