[Haskell-cafe] Usage of . and $
Jefferson Heard
jeff at renci.org
Tue Mar 6 14:43:03 EST 2007
Usually, I can do this, but today, my brain is weak, and I'm just trying to
get this piece of code out the door. My code looks like this:
weight = sum (IntMap.elems (IntMap.intersectionWith
(\x y -> x*y) queryVector rationalProjection))
I know that this will work (ignoring indentation):
sum $ IntMap.elems $ IntMap.intersectionWith (\x y -> x*y) queryVector
rationalProjection
But why won't this?:
sum . IntMap.elems . IntMap.IntersectionWith ...
Is there a difference between the "elegance" of function composition versus
application?
More information about the Haskell-Cafe
mailing list