[Rd] "+" for character method...
Latchezar Dimitrov
ldimitro at wfubmc.edu
Mon Aug 28 02:02:35 CEST 2006
> -----Original Message-----
> From: r-devel-bounces at r-project.org
> [mailto:r-devel-bounces at r-project.org] On Behalf Of Thomas Lumley
> Sent: Sunday, August 27, 2006 6:22 PM
> To: John Chambers
> Cc: R-devel at r-project.org
> Subject: Re: [Rd] "+" for character method...
>
> On Sat, 26 Aug 2006, John Chambers wrote:
>
> > Well, two comments, in two non-compatible directions.
> >
> > 1. I have to say that I find the idea of using "+" to
> paste character
> > strings together aesthetically ugly.
>
> Hear, hear!
>
> In a language where you can define new binary operators
> easily making the same operator do addition and concatenation
> really doesn't seem a good idea. It is done in some other
> languages, but so is using the same operator for printing and
> multiplying by powers of two.
>
> Lack of commutativity is obvious, but lack of associativity
> seems much more dangerous. Suppose x, y, and z are a mixture
> of strings and numbers.
> Hands up everyone who knows (without cheating) whether x+y+z
> would be interpreted the same way in R (with the current
> parser) as in Java or Delphi or Python (and are these all the
> same?). Which of
> "two + two = " + 2 + 2
> 2 + 2 + " = two + two"
> would be correct?
"two + two = " * 2 + 2
2 + 2 * " = two + two"
are both "correct" :-))
Latchezar Dimitrov
Analyst/Programmer
Wake Forest University School of Medicine
However the opinons are mine only.
>
> -thomas
>
> Thomas Lumley Assoc. Professor, Biostatistics
> tlumley at u.washington.edu University of Washington, Seattle
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
More information about the R-devel
mailing list