Martin Drautzburg wrote:
The standard map function applies a single function to a list of arguments. But what if I want to apply a list of functions to a single argument.

So your list of arguments is actually a list of functions. But since functions are first-class values, that shouldn't be a problem. You simply have to write a appropriate function to map over that list of functions:

  map (\f -> f a b c) listOfFunctions

The lambda expression (\f -> f a b c) denotes a function which takes a function f, and applies it to some values a, b and c. That's exactly the function you want to map over the list of functions.

Alternatively, you might want to look into list comprehensions:

  [f a b c | f <- listOfFunctions]

Enjoy Haskell!

  Tillmann
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to