Martin Maechler wrote:

"Spencer" == Spencer Graves <[EMAIL PROTECTED]>
   on Tue, 16 Sep 2003 19:54:22 -0700 writes:


    Spencer> Consider
    Spencer>  Q <- function(x)q("no")

    Spencer> With R 1.7.1 under Windows, "Q()" caused R to close
    Spencer> without asking for confirmation.  This does not
    Spencer> solve the whole problem, but it might provide a
    Spencer> piece of the puzzle.

Apropos, this reminds me of the old quiz (from the S-plus times):

How can you write (quite short!) R code such that
typing
"Q"


-- without any "()" -- will quit R (without asking about saving).

[But you shouldn't really keep that code active in your standard R session
 because it would be too easy to accidentally shut down R !]

For the advanced ones: My shortest solution uses 51 characters of R code, can you beat that?


Less than 51 is not that hard, Martin: 46 (counting line breaks as characters):


Q<-1
class(Q)<-"Q"
print.Q<-function(x)q("no")

Uwe

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to