[Rd] sys.call() inside replacement functions incorrectly returns *tmp*
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.
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:
> 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
> [[alternative HTML version deleted]]
> R-devel using r-project.org mailing list
More information about the R-devel