[R] Quiz {was "Quit asking me .."}

Martin Maechler maechler at stat.math.ethz.ch
Wed Sep 17 09:24:05 CEST 2003


>>>>> "MM" == Martin Maechler <maechler at stat.math.ethz.ch>
>>>>>     on Wed, 17 Sep 2003 08:36:19 +0200 writes:

>>>>> "Spencer" == Spencer Graves <spencer.graves at pdf.com>
>>>>>     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.

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

    MM> How can you write (quite short!) R code such that
    MM> typing
    MM>		"Q"   
    MM> -- without any  "()" -- will quit R (without asking about saving).

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

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

I had overlooked something: Uwe Ligges and Deepayan Sarkar beat it
almost simultaneously with a solution of 43 characters
(when using "=" for assignment).

Martin




More information about the R-help mailing list