Be concise.
Be useful.
All contributions dictatorially edited by webmasters to match personal tastes.
Please do not paste any copyright violating material.
Please try to avoid dependencies to third-party libraries and frameworks.
c=count(p(x))
c := 0
for _, v := range x {
if p(v) {
c++
}
}
func count[T any](x []T, p func(T) bool) int {
c := 0
for _, v := range x {
if p(v) {
c++
}
}
return c
}
let c = x.filter(p).length
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) }