Empty collections behave that way for `set.all { i...
# stdlib
a
Empty collections behave that way for
set.all { it.test }
to be equivalent to
!set.any { !it.test }
in all cases. Found more information here: https://en.wikipedia.org/wiki/Vacuous_truth and http://math.stackexchange.com/questions/202452/why-is-predicate-all-as-in-allset-true-if-the-set-is-empty
👍 4
Though we have to agree that
Copy code
"".all { it.isDigit() && !it.isDigit() && it === Math.random() }
is
true
, we won't get
Copy code
list.map{...}.filter{...}.all{ test }
list.map{...}.filter{...}.none{ !test }
producing different results in runtime when encountering empty collection at the last step after all `map`s and `filter`s