[Rd] Curry: proposed new functional programming, er, function.
Yike Lu
yikelu.home at gmail.com
Wed May 30 20:43:41 CEST 2012
I just realized that even in the non-nested case, calling from top level
"broke" some of my code "inexplicably", since the globally stored
function call gets overridden if you call Curry again. So old Curried
functions break.
Glad to have this fix.
On 5/25/2012 5:23 PM, Hadley Wickham wrote:
>
>> call("function", [...]) calls the "function" function, which itself takes 2
>> arguments: the list of formal args and the function body.
>> eval of this call returns the newly constructed function, which you assign
>> to f. Then you assign the parent.frame() as the environment of f, except
>> with the symbol FUN assigned as the original argument FUN.
>>
>> However, upon looking at the debugger, I find that env$FUN<-FUN assigns FUN
>> in Global Scope if Curry is called from the top level.
>> A nested Curry call then creates FUN=function(...) FUN([...]), a recursive
>> infinite loop.
> Yes, that was a really bad idea - not sure why I didn't see the
> problems when I first wrote it.
More information about the R-devel
mailing list