
On 6 May 2009, at 4:49 am, Nico Rolle wrote:
Hi everyone.
I have a problem. A function is recieving a lambda expression like this: (\ x y -> x > y) or like this (\ x y z a -> (x > y) && (z < a)
Your first function has type Ord a => a -> a -> Bool so your list of parameters must have type Ord a => [a] and length 2. Your second function -- and why do you have the excess parentheses? they make it harder to read -- has type Ord a => a -> a -> a -> Bool so your list of parameters must have type Ord a => [a] and length 3.
but how can i call that expression? [parameters] is my list of parameters for the lambda expression. lambda_ex is my lambda expression
is there a function wich can do smth like that?
lambda _ex (unfold_parameters parameters)
but in both cases lambda_ex wants a single Ord, so unfold_parameters parameters would have to return just that Ord. You _could_ fake something up for this case using type classes, but the big question is WHY do you want to do this? It makes sense for Lisp or Scheme, but not very much sense for a typed language. Why are you building a list [x,y] or [x,y,z] rather than a function (\f -> f x y) or (\f -> f x y z) so that you can do parameters lambda_ex?