On 06/03/07, Nicolas Frisby <[EMAIL PROTECTED]> wrote:
Composition with (.) builds a function, but you eventually want an
Int, so we can't just use (.), but we can come pretty close.
(sum . IntMap.elems . IntMap.IntersectionWith (\x y -> x*y)
queryVector) rationalProjection
Often written:
f . g . h $ x
This is often prefered to the alternative:
f $ g $ h $ x
As it's visually lighter, and involves less editing if you wanted to
get rid of the x (say, you were eta-reducing the expression).
As to why:
f . g . h . x
doesn't work, (.) can only compose two functions, but x is not a
function, it is a value, so you have to apply it to the composite
function f . g . h using the ($) operator or parentheses.
--
-David House, [EMAIL PROTECTED]
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe