"Liaw, Andy" <[EMAIL PROTECTED]> wrote:
        I was bitten by the behavior of all() when given logical(0): It
        is TRUE!  (And any(logical(0)) is FALSE.)  Wouldn't it be better
        to return logical(0) in both cases?
        
It would be disastrous.  For all integer n >= 0,
        all(integer(n) == integer(n))           => TRUE
        any(integer(n) != integer(n))           => FALSE
Your proposal would give wrong answers for n == 0.

For any simple array (who knows what an arbitrary object will do?)
we expect all(x == x) => TRUE, any(x != x) => FALSE.  If this were
changed for empty x, we'd never be able to trust any() or all() again.

Find a book about logic and read how bounded quantification
(\forall x \in set) p(x)
(\exists x \in set) p(x)
is supposed to work when the set is empty.

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to