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

From: Yike Lu <yikelu.home_at_gmail.com>
Date: Wed, 30 May 2012 14:43:41 -0400

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.



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Wed 30 May 2012 - 19:08:21 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 30 May 2012 - 22:42:10 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive