From yikelu.home at gmail.com  Sat May 26 18:30:05 2012
From: yikelu.home at gmail.com (Yike Lu)
Date: Sat, 26 May 2012 12:30:05 -0400
Subject: [Rd] Curry: proposed new functional programming, er, function.
In-Reply-To: <CABdHhvHzLj_BAjx+pMeP2YT9QQEV=_wVw8c3NqTBfp2XHLt6Eg@mail.gmail.com>
References: <7098abec0711011200va3851o811f60bb100616ce@mail.gmail.com>
	<BANLkTi=jud5hhis5y-veQKZHzSYYoPqnBw@mail.gmail.com>
	<79F23BA7BB084E4FA01A8B93904CD02CF669FAA4C9@WIGGUMVS.win.ad.jhu.edu>
	<4DC16917.5090206@gmail.com>
	<BANLkTikuy3OP8j5aymKuE_zmHtYLCkBZWg@mail.gmail.com>
	<79F23BA7BB084E4FA01A8B93904CD02CF669FAA4D7@WIGGUMVS.win.ad.jhu.edu>
	<BANLkTikvfsyZaW4wDB8sA-Z7G-rMQ+11Tg@mail.gmail.com>
	<BANLkTikGcviLYfFska4vkf5GpuCpmKTdJw@mail.gmail.com>
	<BANLkTik-1s+Af541ZkM+mDVkjRx94WM_4w@mail.gmail.com>
	<1337802805327-4631127.post@n4.nabble.com>
	<CABdHhvF1zJpDYXo3i7N30r5OQ0_Qj99_Rzpg-2oNRkdDNJFDfw@mail.gmail.com>
	<4FBFE810.5070405@gmail.com>
	<CABdHhvHzLj_BAjx+pMeP2YT9QQEV=_wVw8c3NqTBfp2XHLt6Eg@mail.gmail.com>
Message-ID: <4FC1050D.3080306@gmail.com>

On 5/25/12 5:23 PM, Hadley Wickham wrote:
> On Fri, May 25, 2012 at 3:14 PM, Yike Lu<yikelu.home at gmail.com>  wrote:
>> So here's the way I'm reading this:
>>
>> Original:
>> curry_call is the function body you're constructing, which is itself just a
>> one liner which calls the symbol FUN with the appropriate substitutions.
>
> Yup.  With a bit more infrastructure you could probably modify it so
> that multiple curries collapsed into the equivalent single curry.
>
Yes I could see how one would do that - if the match.call detects a 
Curry as the first function being called, we would short circuit the 
usual evaluation into a different path which properly collapses all the 
nesting.

It's interesting how R offers these facilities to override the usual 
evaluation order, but if one does that too much it could easily become 
confusing. I was looking at Rpipe the other day 
(https://github.com/slycoder/Rpipe) and the way he implements it is by 
defining his own Eval.

Cheers,



[Rd] Curry: proposed new functional programming, er, function.
Yike Lu