[Haskell-cafe] Re: Map list of functions over a single argument

Gene A yumagene at gmail.com
Wed Feb 21 10:58:14 EST 2007

On 2/21/07, Henning Thielemann <lemming at henning-thielemann.de> wrote:
> On Tue, 20 Feb 2007 apfelmus at quantentunnel.de wrote:
> > Paul Moore wrote:
> > > I'm after a function, sort of equivalent to map, but rather than
> > > mapping a function over a list of arguments, I want to map a list of
> > > functions over the same argument.

Well this is not very sexy, no monads or anything, but I kinda believe in
Keep It Simple:

Prelude> let revApply a f = f a
Prelude> let rMap a fs = map (revApply a) fs
Prelude> rMap 2 [(*4),(^2),(+12),(**0.5)]

oh and I REALLY enjoyed the discussions that this spawned about things
monadic, as there was some really slick stuff in there... The little thing
about 'join' and etcetera... really good stuff.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070221/e146ebc4/attachment-0001.htm

More information about the Haskell-Cafe mailing list