Function malachite_base::iterators::count_is_at_least
source · pub fn count_is_at_least<I: Iterator>(xs: I, n: usize) -> bool
Expand description
Returns whether an iterator returns at least some number of values.
count_is_at_least(xs, n)
is equivalent to xs.count() >= n
for finite iterators, but doesn’t
hang if provided an infinite iterator.
§Examples
use malachite_base::iterators::count_is_at_least;
assert_eq!(count_is_at_least([1, 2, 3, 4].iter(), 3), true);
assert_eq!(count_is_at_least([1, 2, 3, 4].iter(), 4), true);
assert_eq!(count_is_at_least([1, 2, 3, 4].iter(), 5), false);
assert_eq!(count_is_at_least(0.., 5), true);