fn multiproduct<'a, T, I, P, D>(factors: I, product: P, default: D) -> T
where
    T: Clone + 'a,
    I: IntoIterator<Item = &'a T>,
    P: Fn(&T, &T) -> T,
    D: Fn() -> T,
{
    let mut factors = factors.into_iter();

    match (factors.next(), factors.next()) {
        (None, _) => default(),
        (Some(factor), None) => factor.clone(),
        (Some(first), Some(second)) => factors.fold(product(first, second), |p, q| product(&p, q)),
    }
}
/// Returns the multiproduct (i.e. multipyramid, multiprism, multitegum, or
/// multicomb) of an iterator over polytopes. This is built by repeatedly
/// applying the product on two polytopes. In case the iterator is empty, this
/// builds a polytope using the specified default function.
Returns the multiproduct  of an iterator over polytopes. This is built by repeatedly
applying the product on two polytopes. In case the iterator is empty, this
builds a polytope using the specified default function.
Returns the multiproduct of an iterator over polytopes . This is built by repeatedly applying the product on two polytopes . In case the iterator is empty this builds a polytope using the specified default function .
fn multiproduct<'a, T, I, P, D>(factors: I, product: P, default: D) -> T
where
    T: Clone + 'a,
    I: IntoIterator<Item = &'a T>,
    P: Fn(&T, &T) -> T,
    D: Fn() -> T,
{
    let mut factors = factors.into_iter();
    match (factors.next(), factors.next()) {
        (None, _) => default(),
        (Some(factor), None) => factor.clone(),
        (Some(first), Some(second)) => factors.fold(product(first, second), |p, q| product(&p, q)),
    }
}
fn multiproduct < ' a , T , I , P , D > ( factors : I , product : P , default : D ) -> T where T : Clone + ' a , I : IntoIterator < Item = & ' a T > , P : Fn ( & T , & T ) -> T , D : Fn ( ) -> T , { let mut factors = factors . into_iter ( ) ; match ( factors . next ( ) , factors . next ( ) ) { ( None , _ ) => default ( ) , ( Some ( factor ) , None ) => factor . clone ( ) , ( Some ( first ) , Some ( second ) ) => factors . fold ( product ( first , second ) , | p , q | product ( & p , q ) ) , } }
Returns the multiproduct (i.e.
Returns the multiproduct ( i . e .
factors
I
product
P
default
D
factors
I
product
P
default
D