Re: Currying

>At 04:26 PM 5/24/01 -0500, pat hayes wrote:
>>Eg using functions, one encodes an n-ary function - whichis 
>>interchangeable with an n-ary sequence at this level of abstraction 
>>-  as a single-argument function whose value is an (n-1)-argument 
>>function (a trick invented by a logician called Curry, and hence 
>>known as currying.)
>
>Hmmm... I thought Currying worked the other way round:
>
>If 'foo' is a 2-argument function used as
>  (foo a b)
>then 'foo a' is a one argument function, such that
>  ((foo a) b)
>is equivalent to
>  (foo a b)
>so this kind of "partial function evaluation" is left-associative.

Yes, I agree, though the 'left association' usage is a bit misleading 
since the (foo a) here means apply foo to a, rather than apply 
something binary to foo and to a.

>What you describe sounds to me like a right-association;  in truth I 
>can't figure the (n-1) argument function as an argument to the 
>n-argument function.

No, I meant it the way you have it. (Not sure what right-association 
would mean in this context!) The *value* of the 1-ary function is an 
(n-1)-ary function; then repeat the construction recursively. So if 
we start with three arguments
(foo a  b c)
then we get
((foo a) b c)
ie 1-ary whose value (foo a) is a (3-1=) 2-ary; then again
(((foo a) b) c)
ie 1-ary whose value (foo a) is a 1-ary whose value ((foo a) b) is 
also a 1-ary.

Pat

---------------------------------------------------------------------
IHMC					(850)434 8903   home
40 South Alcaniz St.			(850)202 4416   office
Pensacola,  FL 32501			(850)202 4440   fax
phayes@ai.uwf.edu 
http://www.coginst.uwf.edu/~phayes

Received on Friday, 25 May 2001 15:20:51 UTC