[Rd] sys.call() inside replacement functions incorrectly returns *tmp*

Gábor Csárdi c@@rdi@g@bor @ending from gm@il@com
Tue Oct 16 01:23:59 CEST 2018


Seems like there are at least two packages for multiple assignment,
maybe one of them solves your needs, zeallot and dub.

https://r-pkg.org/search.html?q=multiple+assignment

Gabor
On Tue, Oct 16, 2018 at 12:03 AM Abs Spurdle <spurdle.a using gmail.com> wrote:
>
> Kia Ora
>
> > Although I'm not sure what problem it would solve...
>
> Given that you asked, I was interested in writing a multiple assignment
> function as a replacement function, so something like:
> massign (x, y, z) = construct.some list ()
>
> Obviously, that's not possible.
>
> Probably the best example I can think of is converting cartesian
> coordinates to polar coordinates.
> Then we might have something like (note, untested, written in my email):
> cart2polar = function (x, y)
>     list (theta=atan (y / x), r=sqrt (x * x + y * y) )
>
> massign (r, theta) = cart2polar (x, y)
>
> Now, I'm considering a multiple assignment operator, so something like:
> c (theta, r) $<-$ cart2polar (x, y)
>
> And while we're on the topic, I'm also considering an attribute operator
> (to access object attributes), something like:
> myobject%$%myattribute
>
> This would be similar to . in C++/Java or @ in S4.
> And seems like something obvious that's missing from R.
>
> Implementing an attribute read this way is easy, however, implementing an
> attribute assignment this way (without language level support) is difficult.
>
>
> kind regards
> Abs
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list