On 2/21/07, Henning Thielemann <[EMAIL PROTECTED]> wrote:


On Tue, 20 Feb 2007 [EMAIL PROTECTED] 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)]
[8.0,4.0,14.0,1.4142135623730951]

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.
cheers...
gene
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to