Function adapton::catalog::collections::tree_fold_up_nm_dn [] [src]

pub fn tree_fold_up_nm_dn<Lev: Level, Leaf, T: TreeElim<Lev, Leaf>, Res: Hash + Debug + Eq + Clone + 'static, NilF: 'static, LeafF: 'static, BinF: 'static, NameF: 'static>(
    tree: T,
    nm: Option<Name>,
    nil: Rc<NilF>,
    leaf: Rc<LeafF>,
    bin: Rc<BinF>,
    name: Rc<NameF>
) -> Res where
    NilF: Fn(Option<Name>) -> Res,
    LeafF: Fn(Option<Name>, Leaf) -> Res,
    BinF: Fn(Option<Name>, Lev, Res, Res) -> Res,
    NameF: Fn(Option<Name>, Name, Lev, Res, Res) -> Res, 

Like tree_fold_up, except that names from name nodes are passed down, to the next nil and leaf cases. The name from a name constructor associates to its right subtree, which is consistent with a left-to-right, in-order traversal of the tree. The recursive argument nm provides the name for the left subtree, if any.

Regarding naming effects for the RHS functions: The names consumed by the RHS functions for constructors name, leaf and nil overlap. It is thus critical that, e.g., the RHS functions for name and leaf have disjoint write effects. (Either the name RHS uses the given name, or the leaf RHS uses the name, but not both). Similarly, it is thus critical that the RHS functions for name and nil have disjoint write effects.