Sorry for bugging you AGAIN, but I went to get a coffee and I realized you can get down to 26 characters:
class(Q)=Q="no";print.no=q That is a good question to put up on an R/parsing/S3/UseMethod quiz, ehe?! Henrik > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Henrik > Bengtsson > Sent: den 17 september 2003 10:18 > To: 'Deepayan Sarkar'; 'Martin Maechler'; [EMAIL PROTECTED] > Cc: [EMAIL PROTECTED] > Subject: RE: [R] Quiz {was "Quit asking me .."} > > > First, 42 characters... > > Q="no";class(Q)=Q;print.no=function(x)q(Q) > > Interestingly, the following works too (41 chars) > > Q="";class(Q)=Q;print.=function(x)q("no") > > Is it legal though to have empty class names? > > And finally, the beautiful one with 28 characters > > Q="no";class(Q)=Q;print.no=q > > Have nice day! > > Henrik Bengtsson > Lund University > > > -----Original Message----- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] On Behalf Of > Deepayan Sarkar > > Sent: den 17 september 2003 09:17 > > To: Martin Maechler; [EMAIL PROTECTED] > > Subject: Re: [R] Quiz {was "Quit asking me .."} > > > > > > On Wednesday 17 September 2003 01:36, Martin Maechler wrote: > > > > > 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? > > > > Barely, 46 removing all spaces: > > > > print.q<-function(x)q("no");Q<-1;class(Q)<-"q" > > > > We can also replace <- by = in recent (and _ in older) > > versions of R to > > decrease this further. > > > > ______________________________________________ > > [EMAIL PROTECTED] mailing list > > https://www.stat.math.ethz.ch/mailman/listinfo> /r-help > > > > > > ______________________________________________ > [EMAIL PROTECTED] mailing list > https://www.stat.math.ethz.ch/mailman/listinfo> /r-help > > ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
