> (exists integer? '())
nil
> (exists integer? '(a b 3 t 7))
3
> (for-all integer? '(a b 3 t 7))
nil
Well, that's fine. But what about this:
> (for-all integer? '())
true
Is it intentionally so or have I overlooked something?
-----
My newLISP:
newLISP v.10.7.5 64-bit on Linux IPv4/6 UTF-8 libffi
for-all
Re: for-all
The same holds for float:
> (for-all float? '())
true
> (for-all float? '())
true
Re: for-all
It is correct from the perspective of mathematics : the relationship with existential and universal quantification is pretty clear. Math says that (trasposed to newlisp) :
(not (for-all integer? L)) is equivalent to (exists (fn(x) (not (integer? x))) L)
and conversely
(not (exists integer? L)) is equivalent to (for-all (fn(x) (not integer? x))) L)
So once it has been decided that (exists) on an empty list returns nil (which makes sense), (for-all) for an empty list has to return true.
(not (for-all integer? L)) is equivalent to (exists (fn(x) (not (integer? x))) L)
and conversely
(not (exists integer? L)) is equivalent to (for-all (fn(x) (not integer? x))) L)
So once it has been decided that (exists) on an empty list returns nil (which makes sense), (for-all) for an empty list has to return true.
Re: for-all
Mathematically correct -- good to know. Thank you for your help.