Count the elements of a matrix verifying a property : count

### 4.42.27 Count the elements of a matrix verifying a property : count

count takes as arguments : a real function f and a real matrix A of dimension p*q (resp. a list l of size n).
count returns f(A[0,0])+..f(A[p-1,q-1]) (resp. f(l[0])+..f(l[n-1]))
Hence, if f is a boolean function, count returns the number of elements of the matrix A (resp. the list l) verifying the property f.
Input :

count(x->x,[[2,12],[45,3],[7,78]])

Output :

147

indeed: 2+12+45+3+7+78=147.
Input :

count(x->x<10,[[2,12],[45,3],[7,78]])

Output :

3