[Haskell-beginners] Still confused
Marc Gorenstein
marc.gorenstein at gmail.com
Mon Jul 1 20:53:40 CEST 2013
>
> Yes. A section is just this conversion of an infix operator to a prefix
function, but with one parameter carried along with it. You can supply it on
either side as appropriate; (/ 8) is the same as (\x -> x / 8) which in turn
is the same as (\x -> (/) x 8), whereas (8 /) is (\x -> 8 / x) is (\x -> (/) 8
x). Note that it must be *inside* the parentheses to be a section; if it's
outside, then it's a normal function (not operator!) parameter.
Thanks again.
Now I also understand why
Prelude> ( $ 4 ) sqrt
2.0
because it is equivalent to
Prelude> (\x -> x 4) sqrt
2.0
Marc
More information about the Beginners
mailing list