[Rd] local variable assignment: first copies from higher frame?

Murat Tasan mmuurr at gmail.com
Thu Aug 15 17:33:07 CEST 2013


ah, that makes perfect sense in the functional programming sense of things.
thanks!

On Wed, Aug 14, 2013 at 10:19 PM, Peter Meilstrup
<peter.meilstrup at gmail.com> wrote:
> Not anything that complicated -- your answer is in the R language definition
> under 'Subset assignment' and the part in "Function calls" that describes
> assignment functions.
>
> Whenever a call is found on the left side of a `<-`, it is munged by
> sticking a "<-" on the function name and pulling out the first argument. So
>
> my_list$x <- x
>
> which is syntactically equivalent to
>
> `$`(my_list, x) <- x
>
> is effectively transformed into something like:
>
> my_list <- `$<-`(my_list, x, x)
>
> The function `$<-` gets its argument from wherever it is found, and returns
> a modified version.
>
> Peter



More information about the R-devel mailing list