count method

int count(
  1. bool f(
    1. T
    )
)

count up elements applying function f returns true.

Implementation

int count(bool Function(T) f) =>
    fold(0, (acc, element) => f(element) ? acc + 1 : acc);