[R] Multiple comparisons: its a trap!

Gabor Grothendieck ggrothendieck at myway.com
Mon Jul 26 02:47:58 CEST 2004


 <Ted.Harding <at> nessie.mcc.ac.uk> writes:

: 
: On 25-Jul-04 Gabor Grothendieck wrote:
: > Don't know how Python does it but its not the only one and
: > I believe its often done like this. Rather than have a Boolean
: > type, NULL is defined to be false and anything else is true.
: > If the comparison is TRUE then the right argument is returned;
: > otherwise NULL is returned.
: > 
: > Thus
: > 
: >       3 < 5 < 6
: >       ==> (3 < 5) < 6
: >       ==> 5 < 6
: >       ==> 6
: > 
: > which is interpreted as TRUE in if statements, etc.  
: > 
: > Note that the 5 is only evaluated once in the above whereas in
: > 
: >         (3 < 5) and (5 < 6)
: > 
: > it would evaluated twice -- not important here but if 5 is replaced
: > by a function with side effects then it matters.
: 
: This is weird, and I'm not sure what is being discussed here.

We were discussing how some other languages string together comparison 
operators without an intermediate  and  to connect them.  This discussion
has nothing to do with R other than possibly to understand whether it
could fit within the R framework.




More information about the R-help mailing list