Function malachite_base::tuples::singletons
source · pub const fn singletons<I: Iterator>(xs: I) -> Singletons<I> ⓘ
Expand description
Generates all singletons (1-element tuples) with values from a given iterator.
The elements appear in the same order as they do in the given iterator, but wrapped in (_,)
.
The output length is xs.count()
.
§Examples
use itertools::Itertools;
use malachite_base::tuples::singletons;
assert_eq!(
singletons([1, 2, 3].iter().cloned()).collect_vec(),
&[(1,), (2,), (3,)]
);