Message-ID: <CA+YV+HzpqUw7Ur94JxTtvnPWqLxVvCpO-wGwmEyY2dA4POb_FA@mail.gmail.com>
Date: 2013-08-15T15:33:07Z
From: Murat Tasan
Subject: local variable assignment: first copies from higher frame?
In-Reply-To: <CAJoaRhYuKyqxpHdqki0hHuDhZbXA32Xidy9myuLs6y5-gviJ2Q@mail.gmail.com>
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