Comments (10)
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.
Oops, I meant c(a, b, c) %<-% f()
from zeallot.
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.
FWIW I don't think need to overwrite c()
since you never actually evaluate the lhs.
from zeallot.
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.
@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.
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.
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.
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.
New syntax is ready for submission to CRAN, any further suggestions? I feel good about the new, lighter syntax.
from zeallot.
Related Issues (20)
- Multiple assignment of ggplot2 objects HOT 3
- Formally support and test R 3.1 and greater? HOT 1
- Assign multiple types? HOT 1
- Can we get %<->%? HOT 1
- %<-% and %>% HOT 3
- !!! tidy eval in LHS of %<-% ? HOT 1
- Working in a for loop HOT 2
- improving traceback of rhs errors
- Destructuring Assignment by Name HOT 10
- A named unpacking function sans %->%? HOT 5
- version support R 3.1 never sent to CRAN
- Set := to %<-% HOT 3
- Support for partial assignment HOT 3
- Better tracebacks with rlang
- Could an second variation on the operator be created so it doesn't with %<-% from future HOT 6
- Improve step-in functionality during debugging
- ...x can be empty
- no visible binding for global variable for CRAN check HOT 2
- Move `master` branch to `main` HOT 1
- Conflict with future package HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zeallot.