count up elements applying function f returns true.
int count(bool Function(T) f) => fold(0, (acc, element) => f(element) ? acc + 1 : acc);