Determine the number c of elements in the list x that satisfy the predicate p.
func count[T any](x []T, p func(T) bool) int { c := 0 for _, v := range x { if p(v) { c++ } } return c }
c := 0 for _, v := range x { if p(v) { c++ } }
c=count(p(x))
let c = x.filter(p).length
import static java.util.Collections.frequency;
int c = frequency(x, p);
c := 0; for el in x do if p(el) then Inc(c);
my $c = grep { p($_) } @x;
c = sum(p(v) for v in x)
c = x.count{|el| p(el) }
No security, no password. Other people might choose the same nickname.