Skip to content

Instantly share code, notes, and snippets.

@hadley
Last active Aug 29, 2015
Embed
What would you like to do?
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