_wurli,
@_wurli@fosstodon.org avatar

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 , 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.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • meta
  • rosin
  • cisconetworking
  • thenastyranch
  • magazineikmin
  • hgfsjryuu7
  • DreamBathrooms
  • InstantRegret
  • Youngstown
  • slotface
  • PowerRangers
  • Durango
  • everett
  • kavyap
  • vwfavf
  • anitta
  • modclub
  • ethstaker
  • khanakhh
  • tacticalgear
  • ngwrru68w68
  • osvaldo12
  • mdbf
  • tester
  • cubers
  • Leos
  • GTA5RPClips
  • normalnudes
  • provamag3
  • All magazines