ClojureDocs

导航

命名空间

every

  • (every pred & {:keys [into kind count max-count min-count distinct gen-max gen], :as opts})
takes a pred and validates collection elements against that pred.
 Note that 'every' does not do exhaustive checking, rather it samples
*coll-check-limit* elements. Nor (as a result) does it do any
conforming of elements. 'explain' will report at most *coll-error-limit*
problems.  Thus 'every' should be suitable for potentially large
collections.
 Takes several kwargs options that further constrain the collection:
 :kind - a pred that the collection type must satisfy, e.g. vector?
      (default nil) Note that if :kind is specified and :into is
      not, this pred must generate in order for every to generate.
:count - specifies coll has exactly this count (default nil)
:min-count, :max-count - coll has count (<= min-count count max-count) (defaults nil)
:distinct - all the elements are distinct (default nil)
 And additional args that control gen
 :gen-max - the maximum coll size to generate (default 20)
:into - one of [], (), {}, #{} - the default collection to generate into
    (default: empty coll as generated by :kind pred if supplied, else [])

Optionally takes :gen generator-fn, which must be a fn of no args that
returns a test.check generator
 See also - coll-of, every-kv