liveBook · Manning

Not-every?

As explained in Clojure: The Essential Reference

not-every? is a Clojure function that returns the logical negation of every? for a predicate and collection.

not-every? takes a one-argument predicate and a collection, applies the predicate to the elements, and returns true when not every result is truthy. It is equivalent to negating every? on the same inputs. section 8.1.5

Its contract includes:

  • The predicate may return any value; Clojure truthiness determines whether each result counts as true. section 8.1.5
  • The collection must support seq; unsupported inputs, including transients, raise IllegalArgumentException. section 8.1.5
  • The result is always true or false. section 8.1.5
  • An empty collection makes every? true, so not-every? returns false. section 8.1.5

Testing whether all values are negative

(not-every? neg? [-1 -2 0 -3]) ;; true The result is true because 0 does not satisfy neg?.

How Clojure: The Essential Reference covers it

How deep it goes
Defines inputs, truthiness, Boolean output, empty collections, and unsupported collections, but gives limited implementation detail.
Examples
Uses neg? over [-1 -2 0 -3] to demonstrate a failing predicate result.
What it assumes
Assumes familiarity with predicates, collections, seq-compatible inputs, and Clojure truthiness.
What you can do after
Apply it to test whether at least one collection element fails a predicate and obtain a Boolean result.
How it connects
Relates not-every? to every?, some, not-any?, predicates, collections, seq, and Boolean logic.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Clojure: The Essential Reference. The section links point to the parts of the book it draws on.