Count
The number of elements equal to value in the collection.
✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram Language
Count✓Count(collection, value)the number of elements equal to value.Count(QuotientRing(Integers, m)) exactly, past too (the quotient-ring-collection patch).Count(collection, value, level)matches counted down to level (levels 1 through level), or — with level written as — at that level only.Typed signatures
| Type | Package | Applies |
|---|---|---|
(collection<any>, any?) -> infinity | integer | combinatoricsreplaces compute-engine | always |
(collection<any>, any?) -> infinity | integer | compute-engine | always |
(collection<any>, any?) -> infinity | integer | residuesreplaces compute-engine | always |
Details
- A value absent from the collection counts as 0.
- A lazy family's count past comes back as the exact integer, when its kernel counts in bigint.
- Tests exact equality against a fixed value — not a Wolfram-style typed pattern like
_Integer. - See Length for the total element count, and IndexOf for a single matching position.
- A bare integer level spec counts matches at every level from 1 through it; counts that level only.
Examples
6 more kept as data, checked against the oraclesScope #
Possible issues #
Count tests exact equality; a typed pattern like _Integer matches nothing
InOut
Wolfram's _Integer pattern counts every integer element, here 2 (1 and 2).
Count tests exact equality, so a pattern like matches nothing
live ↗InOut
Wolfram's _Integer pattern counts every integer element, here 4 (2, 1, 3, 3).
About
| Examples | 19 |
|---|---|
| Checked against | Wolfram Language 10 agree |
| Crosswalk | Wolfram Language |