Re: [Haskell-cafe] Currying function using values from array

2008-08-08 Thread Ryan Ingram
2008/8/7 Sukit Tretriluxana [EMAIL PROTECTED]: How in Haskell that I can create a function that curries any other function, which receives multiple parameters, by using a the input from a list (same data type) or a tuple (mixed data type) such that it either returns another closure (if not all

Re: [Haskell-cafe] Currying function using values from array

2008-08-08 Thread Lemming
Sukit Tretriluxana schrieb: Thanks Tom and Henning for your response. Let me put the question in another way by generalizing and tweaking it a little bit. How in Haskell that I can create a function that curries *any *other function, which receives multiple parameters, by using a the input

Re: [Haskell-cafe] Currying function using values from array

2008-08-08 Thread Sukit Tretriluxana
Thanks so much for the response so far. To Lemming's question, this is just a theoretical question. I try comparing what I can do in Groovy with Haskell. So far I could come up with solutions but not this one. I'm not an expert on this but I'm not sure if template haskell or type class would come

[Haskell-cafe] Currying function using values from array

2008-08-07 Thread Sukit Tretriluxana
Dear Haskell experts, I am currently studying Groovy language. An experiment I did with its closure is to perform closure/function curry using an array containing the values for the parameter binding. See the sample below. int addThemUp(a,b,c,d,e) { a+b+c+d+e } def arrayCurry(arr, cls) {

Re: [Haskell-cafe] Currying function using values from array

2008-08-07 Thread Henning Thielemann
On Thu, 7 Aug 2008, Sukit Tretriluxana wrote: Dear Haskell experts, I am currently studying Groovy language. An experiment I did with its closure is to perform closure/function curry using an array containing the values for the parameter binding. See the sample below. int

Re: [Haskell-cafe] Currying function using values from array

2008-08-07 Thread Tom Nielsen
Maybe you want something like curryWithList :: ([a]-b)-[a]-([a]-b) curryWithList f lst1= \lst2 -f (lst1++lst2) addThemUp = sum curried = curryWithList addThemUp [1,2,3,4] curried [5] =15 On Thu, Aug 7, 2008 at 8:35 PM, Henning Thielemann [EMAIL PROTECTED] wrote: On Thu, 7 Aug 2008, Sukit

Re: [Haskell-cafe] Currying function using values from array

2008-08-07 Thread Sukit Tretriluxana
Thanks Tom and Henning for your response. Let me put the question in another way by generalizing and tweaking it a little bit. How in Haskell that I can create a function that curries *any *other function, which receives multiple parameters, by using a the input from a list (same data type) or a

Re[2]: [Haskell-cafe] Currying function using values from array

2008-08-07 Thread Bulat Ziganshin
Hello Sukit, Friday, August 8, 2008, 3:52:51 AM, you wrote: it requires use of typeclasses instance C f = C (a-f) curry (somef::(a-f)) (someas::[a]) = (somef (head someas)) (tail someas) and so on. look into hslua sources, for example: