I wonder if R functions can know the name of the variable their result is assigned to.
e.g.
selfaware_squared <- function(x) {
cat("Assigning square to variable name '", some_magic, "'.")
return(x^2)
}
> a <- selfaware_squared(2)
Assigning square to variable name ' a '.