Re: [Haskell-cafe] Newbie: Applying Unknown Number Arguments to A Partial Function

2006-05-30 Thread Greg Buchholz
Aditya Siram wrote: ] I am trying to write a function 'applyArguments' which takes a ] function and a list and recursively uses element each in the list as ] an argument to the function. I want to do this for any function taking ] any number of arguments. ] ] applyArgument f (arg) = f arg ] applyA

Re: [Haskell-cafe] Newbie: Applying Unknown Number Arguments to A Partial Function

2006-05-19 Thread Greg Buchholz
Greg Buchholz wrote: > instance Apply a b c => Apply (a->b) b (a,c) where Whoops, instead of that, I think I meant... instance Apply (b->c) c d => Apply (a->b->c) (b->c) (a,d) where ...where we strip off one layer of types, because of the recursion. Of course, that still doesn't work though. G

Re: [Haskell-cafe] Newbie: Applying Unknown Number Arguments to A Partial Function

2006-05-19 Thread Greg Buchholz
Aditya Siram wrote: ] I am trying to write a function 'applyArguments' which takes a function and ] a list and recursively uses element each in the list as an argument to the ] function. I want to do this for any function taking any number of arguments. ] ] applyArgument f (arg) = f arg ] applyA

Re: [Haskell-cafe] Newbie: Applying Unknown Number Arguments to A Partial Function

2006-05-19 Thread Robert Dockins
On May 19, 2006, at 2:49 PM, Jeremy Shaw wrote: Hello, You can do it -- but it may not be very useful in its current form. The primary problem is, "What is the type of 'f'?" applyArgument f [arg] = f arg -- NOTE: I changed (arg) to [arg] applyArgument f (arg:args) = applyArgument (f arg) arg

Re: [Haskell-cafe] Newbie: Applying Unknown Number Arguments to A Partial Function

2006-05-19 Thread Jeremy Shaw
Hello, You can do it -- but it may not be very useful in its current form. The primary problem is, "What is the type of 'f'?" > applyArgument f [arg] = f arg -- NOTE: I changed (arg) to [arg] > applyArgument f (arg:args) = applyArgument (f arg) args Looking at the second line, it seems that f i

Re: [Haskell-cafe] Newbie: Applying Unknown Number Arguments to A Partial Function

2006-05-19 Thread Arthur Baars
My apologies to Chris, I think I misinterpreted Aditya's description. Thanks to David House for telling me. I thought he was describing a function such as map instead of "polyvaric functions", which would have been more likely for a "newbie" :-) So to answer Aditya's question, whether you can

Re: [Haskell-cafe] Newbie: Applying Unknown Number Arguments to A Partial Function

2006-05-19 Thread Arthur Baars
Chris, the subject states clearly that Aditya is a Newbie, and is most likely just trying to define the function "map". So I think pointing to a bunch of advanced type magic tricks is not really helpful. Aditya, you say you want the function applyArgument to take a function and a list and appl

Re: [Haskell-cafe] Newbie: Applying Unknown Number Arguments to A Partial Function

2006-05-19 Thread Chris Kuklewicz
Aditya Siram wrote: > I am trying to write a function 'applyArguments' which takes a function > and a list and recursively uses element each in the list as an argument > to the function. I want to do this for any function taking any number of > arguments. > > applyArgument f (arg) = f arg > applyA

Re: [Haskell-cafe] Newbie: Applying Unknown Number Arguments to A Partial Function

2006-05-18 Thread Shiqi Cao
You can't do this in Haskell, if you try to type the function carefully, you'll know the reason. Shiqi On 5/18/06, Aditya Siram <[EMAIL PROTECTED]> wrote: I am trying to write a function 'applyArguments' which takes a function and a list and recursively uses element each in the list as an argume

[Haskell-cafe] Newbie: Applying Unknown Number Arguments to A Partial Function

2006-05-18 Thread Aditya Siram
I am trying to write a function 'applyArguments' which takes a function and a list and recursively uses element each in the list as an argument to the function. I want to do this for any function taking any number of arguments. applyArgument f (arg) = f arg applyArgument f (arg:args) = applyArg