/**
* Count the values in the array matching a predicate.
*
* @tsplus static effect/core/stm/TArray.Aspects count
* @tsplus pipeable effect/core/stm/TArray count
*/
export function count(f: Predicate) {
return (self: TArray): STM =>
self.reduce(
0,
(n, a) => (f(a) ? n + 1 : n)
)
}