That's exactly what i was looking for. Thank you very much !!!
Cheers,
André
ChrisK wrote:
There is the "flip" function which changes the order of the first 2
parameters
Prelude> :t flip
flip :: forall c a b. (a -> b -> c) -> b -> a -> c
So I think
map ( (flip foo) 5 ) my_list_of_lists_of_doubles
will work, as will using a lambda expression
map (\x -> foo x 5) may_list_of_lists_of_doubles
André Vargas Abs da Cruz wrote:
Hi,
I have been using Haskell for a few weeks now and I can say that I am
totally impressed by how easy it is to program with it. I am now doing
some small exercises to get used to the language syntax and I have a
little (newbie) question:
Suppose I declare a function foo like:
foo :: [Double] -> Int -> Int
foo a b
Suppose now that I want to apply this function to a list that
contains lists of doubles (something like [[Double]]) using map, but I
want to keep the 'b' parameter fixed (with a value of 5 for instance).
Is it possible to use map passing the function foo with the 2nd argument
only ? In other words, if I wrote this function like:
foo :: Int -> [Double] -> Int
I could clearly call it with:
map (foo 5) my_list_of_lists_of_doubles
But how to do that (if possible) when I invert the parameters list ?!
Thanks in advance,
Andre Abs da Cruz
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
--
-------------------------------------------------------
André Vargas Abs da Cruz
Laboratório de Inteligência Computacional Aplicada
Departamento de Engenharia Elétrica
Pontifícia Universidade Católica - Rio de Janeiro
http://www.ica.ele.puc-rio.br/
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe