[prev in list] [next in list] [prev in thread] [next in thread] 

List:       haskell-beginners
Subject:    [Haskell-beginners] Re: Function composition
From:       allbery () ece ! cmu ! edu (Brandon S !  Allbery KF8NH)
Date:       2008-10-25 19:18:25
Message-ID: 20FCD53A-183A-4E95-A855-2DB6BD023171 () ece ! cmu ! edu
[Download RAW message or body]

On 2008 Oct 25, at 18:44, Glurk wrote:
>> Or, does it take the only valid parameter I give it, the a, and  
>> then form a
> function out of this (a==), and then compose this new function with  
> filter,
> which does take a function of this new type. Then, there is one  
> parameter
> left, [a], which is what this new function needs...and so it all  
> works out !

This is it exactly.

> Why doesn't it try to take the 2 parameters for (==)

In reality there are no two-parameter functions.  They are actually  
single-parameter functions which return functions.  Thus only one  
argument will ever be consumed by a particular application.

Symbolically:  (\a b -> f a b) = \a -> (\b -> f a b) taking argument a  
and returning the function (\b -> f a b) with a having whatever value  
it was given in the first application (in other languages this is  
often referred to as a closure).

-- 
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic