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
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
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
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
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
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
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
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
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
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
10 matches
Mail list logo