[R] recommendations on use of -> operator

Emmanuel Charpentier charpent at bacbuc.dyndns.org
Thu Mar 18 20:10:00 CET 2010


An old (Lisp ? C ?) quote, whose author escapes me now, was :

"syntactic sugar causes cancer of the semicolon"

.. but nowadays semicolons are rarely used in "real-life" R.

					Emmanuel Charpentier

PS and, BTW, neither C nor Lisp have much use for semicolons... Was that
Pascal (or one of its spawns) ? 

Le jeudi 18 mars 2010 à 12:00 +0000, Prof Brian Ripley a écrit :
> -> is usually only used when you suddenly remember you wanted to keep 
> result of a computation, especially in the days before command-line 
> editors were universal.
> 
> fn(a,b) ... oh I'd better keep that ... -> z
> 
> On Thu, 18 Mar 2010, Dan Kelley wrote:
> 
> > I have never used   ->  but I noticed at
> >
> > 	http://github.com/jiho/r-utils/blob/master/beamer_colors.R
> >
> > that some people do.
> 
> > In fact, the above-named code has a sort of elegance about it 
> (except 
> for the use of "=" for assignment...).  To my eye,  ->   calls to mind a type of assignment that is meant to stand out.  For example, perhaps it would make sense to use  ->  to assign to things that are not expected to vary through the rest of the code block.
> >
> > Q1: is there a convention, informal or otherwise, on when to use the   ->   operator?
> >
> > Q2: if there is no convention, but if people think a convention might help, what would that convention be?
> >
> > Dan Kelley, PhD
> > Professor and Graduate Coordinator
> > Dept. Oceanography, Dalhousie University, Halifax NS B3H 4J1
> > kelley.dan at gmail.com (1-minute path on US server) or Dan.Kelley at Dal.Ca (2-hour path on Cdn server)
> > Phone 902 494 1694;  Fax  902 494 3877
> >
> >
> >
> >
> >
> >
> >
> >
> > 	[[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
> 



More information about the R-help mailing list