Giter VIP home page Giter VIP logo

Comments (10)

nteetor avatar nteetor commented on June 16, 2024

The original zeallot, named allotalot at the time, syntax used a .() helper function to construct the LHS of an assignment expression.

.(a, b, c) %<-% f()

With that syntax the %<-% could be dropped and similar to vadr's bind functionality <- could be used instead.

I am wary of overwriting <- or c(). However, I do agree a simpler syntax would be nice.

from zeallot.

hadley avatar hadley commented on June 16, 2024

Oops, I meant c(a, b, c) %<-% f()

from zeallot.

nteetor avatar nteetor commented on June 16, 2024

Yes, I don't see why that wouldn't be possible.

Would the nested syntax look as follows,
c(a, c(b, d), e) %<-% f()

from zeallot.

jimhester avatar jimhester commented on June 16, 2024

FWIW I don't think need to overwrite c() since you never actually evaluate the lhs.

from zeallot.

nteetor avatar nteetor commented on June 16, 2024

Yep, I agree. The overwriting was brought up, but is no longer relevant because of @hadley 's correction to the proposed alternative syntax.

from zeallot.

nteetor avatar nteetor commented on June 16, 2024

@jimhester, you have me thinking though, is there a reason why a `c<-`() function couldn't be implemented? Upon first consideration this seems like a way around overwriting <- and defining the custom %<-%.

from zeallot.

nteetor avatar nteetor commented on June 16, 2024

With some further fiddling I see there are plenty of hurdles along the `c<-`() route, if it's possible at all. Proceeding with %<-%.

from zeallot.

jimhester avatar jimhester commented on June 16, 2024

I similar idea is https://github.com/crowding/vadr/blob/master/R/bind.R#L65. Which has the advantage of not requiring an redefinition of <-, but the drawback of requiring an object to dispatch on. Using that approach you could have syntax like

.[x, y] <- c(1, 2)

from zeallot.

nteetor avatar nteetor commented on June 16, 2024

I became aware of vadr this morning when hadley brought it to my attention. I see now in the comments of bind.R, crowding was talking about how `bind<-` would mangel the call, so he settled for [<-.bind.

I like avoiding a different assignment operator. Unfortunately, nesting variables with .[ feels a little nutty. I would imagine it looks something like this.

.[w, .[x, y], z] <- list(1, list(2, 3), 4)

from zeallot.

nteetor avatar nteetor commented on June 16, 2024

New syntax is ready for submission to CRAN, any further suggestions? I feel good about the new, lighter syntax.

from zeallot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.