count ( ... seq quot: ( ... elt -- ... ? ) -- ... n )


Vocabulary
sequences

Inputs and outputs
seqa sequence
quota quotation
nan integer


Word description
Efficiently returns the number of elements that the predicate quotation matches.

Examples
USING: math math.ranges sequences prettyprint ; 100 [1,b] [ even? ] count .
50


Definition


: count ( ... seq quot: ( ... elt -- ... ? ) -- ... n )
[ 1 0 ? ] compose map-sum ; inline