Has anyone constructed a quine (\"A program that generates a copy of its own source text as its complete output\": http://www.nyx.net/~gthompso/quine.htm) in R? (The [quine] ta
Using what body
does as inspiration, call
can be used to reproduce the calling command:
f <- function ()
{
call("<-", as.name(as.character(sys.calls()[[1]])), sys.function(sys.parent()))
}
Which outputs:
> f()
f <- function ()
{
call("<-", as.name(as.character(sys.calls()[[1]])), sys.function(sys.parent()))
}