Skip to content

NoneTrue ​

Whether no element of a collection satisfies a predicate.

✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram LanguageNoneTrue✓
NoneTrue(xs, predicate)TrueTrue if predicatepredicate holds for no element of xsxs, else FalseFalse.
Typed signatures
TypePackageApplies
(indexed_collection<T>, (T) any -> boolean) -> boolean where Tcombinatoricsalways

Domain: Collections

Details
  • The negation of Any: NoneTrue(xs,p)=Not(Any(xs,p))NoneTrue(xs, p) = Not(Any(xs, p)).

Examples

Basic #
live ↗
InNoneTrue([1,3,5],IsEven)\mathrm{NoneTrue}(\bigl\lbrack1, 3, 5\bigr\rbrack, \mathrm{IsEven})OutTrue\mathrm{True}
live ↗
InNoneTrue([1,2,3],IsEven)\mathrm{NoneTrue}(\bigl\lbrack1, 2, 3\bigr\rbrack, \mathrm{IsEven})OutFalse\mathrm{False}

False because some elements are even

live ↗
InNoneTrue([1,2,3,4,5,6],IsEven)\mathrm{NoneTrue}(\bigl\lbrack1, 2, 3, 4, 5, 6\bigr\rbrack, \mathrm{IsEven})OutFalse\mathrm{False}

True when no element passes the test

live ↗
InNoneTrue([1,3,5,7,9],IsEven)\mathrm{NoneTrue}(\bigl\lbrack1, 3, 5, 7, 9\bigr\rbrack, \mathrm{IsEven})OutTrue\mathrm{True}

Symbolic entries leave the test undecided, while 8<108<10 already settles it

live ↗
InNoneTrue([12,16,x,8,14,y],_1⁡↦_1⁡<10)\mathrm{NoneTrue}(\bigl\lbrack12, 16, x, 8, 14, y\bigr\rbrack, \operatorname{\_1}↦\operatorname{\_1}\lt10)OutFalse\mathrm{False}

Wrapping with IsTrue makes undecided tests count as not true

live ↗
InNoneTrue([12,16,x,14,y],_1⁡↦IsTrue(_1⁡<10))\mathrm{NoneTrue}(\bigl\lbrack12, 16, x, 14, y\bigr\rbrack, \operatorname{\_1}↦\mathrm{IsTrue}(\operatorname{\_1}\lt10))OutTrue\mathrm{True}
Scope #

Vacuously true on an empty list

live ↗
InNoneTrue([],IsEven)\mathrm{NoneTrue}(\bigl\lbrack\bigr\rbrack, \mathrm{IsEven})OutTrue\mathrm{True}

An undecided predicate gives the Nor of its values, as Wolfram does

live ↗
InNoneTrue([a,b],f)\mathrm{NoneTrue}(\bigl\lbrack a, b\bigr\rbrack, f)Outf(a)⊽f(b)f(a)⊽f(b)

One True settles it, whatever else is undecided

live ↗
InNoneTrue([a,4],IsEven)\mathrm{NoneTrue}(\bigl\lbrack a, 4\bigr\rbrack, \mathrm{IsEven})OutFalse\mathrm{False}
Properties #

The negation of Any

live ↗
InNoneTrue([4,6,9],IsPrime)=¬Any([4,6,9],IsPrime)\mathrm{NoneTrue}(\bigl\lbrack4, 6, 9\bigr\rbrack, \mathrm{IsPrime})=¬\mathrm{Any}(\bigl\lbrack4, 6, 9\bigr\rbrack, \mathrm{IsPrime})OutTrue\mathrm{True}
About
Examples10
Checked againstWolfram Language 10 agree
CrosswalkWolfram Language

See also: All, Any