[Haskell-cafe] Newbie syntax question

André Vargas Abs da Cruz andrev at ele.puc-rio.br
Fri Sep 16 14:55:16 EDT 2005


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


More information about the Haskell-Cafe mailing list