Survey: what new bit of syntax would you like in base #RStats?
What should the following bits of syntax do?
* ===
* ++ And --
* +=
* //
* ?
* {{ }}
* [[[ ]]]
* <<==
* (?: X)
Survey: what new bit of syntax would you like in base #RStats?
What should the following bits of syntax do?
* ===
* ++ And --
* +=
* //
* ?
* {{ }}
* [[[ ]]]
* <<==
* (?: X)
#RStats syntax hypothetical
count += 2
Increases 'count' by 2
Which means the following would be valid:
p <- ggplot()
p += geom_point(...)
p += geom_text(...)
@hadleywickham @coolbutuseless @jimhester Triple it for some added personality! `???` turns a boring conditional statement into one oozing with incredulity
x <- h > 3 ??? 1 : 2
#RStats syntax hypothetical
{{ }} initiates a mode where whitespace is significant and R code can be formatted like python
{{
for (i in x)
s += I
cat("inside loop: ", s, "\n")
print("loop finished")
}}
#RStats syntax hypothetical
for (v) {...}
is an anonymous for-loop.
Default variable is "_" or ".x" or something
#RStats syntax hypothetical
add 1 2
Bare function calls with arguments separated by space
Which gives rise to the following being allowed function calls:
git pull
luke i am your father
#RStats syntax hypothetical
mean?
This is the same as "?mean" i.e. you can put the "?" at the end of the function name to access the documentation for that function
#RStats syntax hypothetical
f <- function(year, x) {
# lunar phase for xth day of year
...
}
Three dots in a row is known as The Friday Operator.
R will call an LLM and get it to write the rest of the code.

@coolbutuseless
++ Increment
-- decrement
Btw some of these do exist, in the tidyverse for example curly curly {{ }} calls entities within functions. Or are you talking about base R?
* === as identical() (vectorized over list() elements, please!)
* // as integer division (like the complement of %%
* ? as a FALSE-coalescing infix operator à la `%||%`
* [[[ ]]] as a defensive version of `[[` that checks for "scalar (chr/int/etc.)" type
* (?: X) as syntactic sugar for quote()
* <<== as like <<- but assigns into ALL parent environments for maximum chaos
@yjunechoe snap!!!
I also want === to be vectorised 'identical()'
@coolbutuseless We already have `<-` and `->`, so why can't I assign up or down?
Let's add `^` and `v` assignment.
@coolbutuseless also, I want to propose `<--` for assigning in the parent frame, or `<---` for in the parent's parent and so on.
The length of the tail is how far back to assign.