Skip to content

Instantly share code, notes, and snippets.

@hadley
Last active August 29, 2015 13:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hadley/8804787 to your computer and use it in GitHub Desktop.
Save hadley/8804787 to your computer and use it in GitHub Desktop.
next_letter <- local({
i <- 0
function() {
i <<- i + 1
paste0("x_", c(letters, LETTERS))[i]
}
})
f <- function() {
new_arg <- alist(x = )
names(new_arg) <- next_letter()
formals(f) <<- c(formals(f), new_arg)
}
f()
f()
f()
f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment