Function malachite_base::iterators::count_is_at_most
source · pub fn count_is_at_most<I: Iterator>(xs: I, n: usize) -> bool
Expand description
Returns whether an iterator returns at most some number of values.
count_is_at_most(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_most;
assert_eq!(count_is_at_most([1, 2, 3, 4].iter(), 3), false);
assert_eq!(count_is_at_most([1, 2, 3, 4].iter(), 4), true);
assert_eq!(count_is_at_most([1, 2, 3, 4].iter(), 5), true);
assert_eq!(count_is_at_most(0.., 5), false);