_wurli, #RStats syntax idea: f(unction)-strings.
One could define a function to operate on a single string like so:
g"
<- function(x) {
glue::glue(x, .envir = parent.frame())
}This would basically give you something very similar to Python's f-strings:
g"1 + 1 = {1 + 1}"
#> [1] "1 + 1 = 2"This idea comes from #julialang, which lets you define non-standard string literals in the same way: https://docs.julialang.org/en/v1/manual/metaprogramming/#meta-non-standard-string-literals
For me, this actually feels in keeping with R's stripped back, functional vibe.
Add comment