[Haskell-cafe] calling a variable length parameter lambda expression

Daniel Peebles pumpkingod at gmail.com
Wed May 6 11:40:52 EDT 2009


isn't doLam just id with an Ord restriction there?

On Wed, May 6, 2009 at 5:55 AM, Victor Nazarov
<asviraspossible at gmail.com> wrote:
> On Tue, May 5, 2009 at 8:49 PM, Nico Rolle <nrolle at web.de> 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)
>>
>> my problem is now i know i have a list filled with the parameters for
>> the lambda expression.
>> 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)
>
> Why not:
>
> lam1 = \[x, y] -> x > y
> lam2 = \[x, y, z, a] -> (x > y) && (z < a)
>
> doLam :: Ord a => ([a] -> Bool) -> [a] -> Bool
> doLam lam params = lam params
>
> So, this will work fine:
>
> doLam lam1 [1, 2]
> doLam lam2 [1,2,3,4]
>
> --
> Victor Nazarov
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>


More information about the Haskell-Cafe mailing list