# Re: Currying

From: pat hayes <phayes@ai.uwf.edu>
Date: Fri, 25 May 2001 14:20:43 -0500
Message-Id: <v04210108b7345edde73e@[205.160.76.208]>
To: Graham Klyne <GK@ninebynine.org>

```>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
(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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:45:38 UTC