[Haskell-beginners] ($) operator
Brent Yorgey
byorgey at seas.upenn.edu
Sun Jan 25 09:12:06 EST 2009
On Sun, Jan 25, 2009 at 05:34:35AM +0000, John Hartnup wrote:
> 2009/1/24 Brent Yorgey <byorgey at seas.upenn.edu>:
>
> >
> > map ($5) [(+1), (^2), abs]
> >
> > which evaluates to [6,25,5].
> >
>
> Just to check I understand correctly - you're using ($) to 'promote'
> an expression into a function, in order that it may be used in higher
> order functions?
In this case, I'm using ($) to *make* a higher-order function---($5)
is a function which takes its argument (which must be a function) and
applies it to 5. (I'm assuming you're familiar with 'operator
sections', if you aren't I can explain that too.)
-Brent
More information about the Beginners
mailing list