[Haskell-beginners] Still confused
Michael Peternell
michael.peternell at gmx.at
Mon Jul 1 20:23:43 CEST 2013
(/ 8)
is the same as
(\x -> x / 8)
you can think of it as
(HERE_IS_SOMETHING_MISSING / 8)
whereas
(/) 8
is normal function currying, i.e. it is the same as
(\x -> (/) 8 x)
or
(\x -> 8 / x)
just like
foo y
is the same as
(\x -> foo y x)
if foo is a function that takes 2 parameters.
on the other hand
(8 /)
is like
(8 / HERE_IS_SOMETHING_MISSING)
which translates to
(\x -> 8 / x)
Am 01.07.2013 um 20:03 schrieb Marc Gorenstein <marc.gorenstein at gmail.com>:
> Hi Brandon, Darren, and Michael,
>
> Thanks for you responses, but I'm still confused.
>
> Here are two examples of operator sections. The first takes the infix operator
> / and turns it into a prefix operator.
>
> Prelude> let eight_div_by = ((/) 8 )
> Prelude> eight_div_by 4
> 2.0
>
> I get that. But look at the following: We now have a prefix operator with
> the input on the "wrong" side.
>
> Prelude> let div_by_eight = ( / 8 )
> Prelude> div_by_eight 4
> 0.5
>
> Why should ( / 8) 4 = 0.5?
>
>
> Thanks again,
>
> Marc
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
More information about the Beginners
mailing list