
5 Oct
2009
5 Oct
'09
10:34 a.m.
If I have a list containing the arguments I want to give to a function, is there a general way to supply those arguments in a compact syntax? In other words, I could have args = [1,2,3] f x y z = ... I would write t = f (args!!0) (args!!1) (args!!2) but there may be a neater, more general syntax. I tried writing a fold with $, but I don't think that works because the type of each step is different. I.e. f :: a -> a -> a -> a f x :: a -> a -> a f x y :: a -> a f x y z :: a This would seem to preclude a general way of writing a function that supplies arguments from a list.