///
/// Walk from tree to a leaf.
///
/// @param internalNodeFn - function applied to internal nodes. Takes current internal node and current IR, returns
///                       new internal nod and new IR
/// @param leafFn         - function applied to leafss. Takes current leaf and current IR, returns result of walk LR
/// @param initial        - initial value of IR
/// @tparam IR - result of applying internalNodeFn to internal node. E.g. some accumutalor of previous results
/// @tparam LR - result of applying leafFn to a leaf. Result of all walk application
/// @return
///
Walk from tree to a leaf.
@param internalNodeFn - function applied to internal nodes. Takes current internal node and current IR, returns
new internal nod and new IR
@param leafFn         - function applied to leafss. Takes current leaf and current IR, returns result of walk LR
@param initial        - initial value of IR
@tparam IR - result of applying internalNodeFn to internal node.
Walk from tree to a leaf . @param internalNodeFn - function applied to internal nodes . Takes current internal node and current IR returns new internal nod and new IR @param leafFn - function applied to leafss . Takes current leaf and current IR returns result of walk LR @param initial - initial value of IR @tparam IR - result of applying internalNodeFn to internal node .
pub fn tree_walk<IR, LR>(
        &self,
        internal_node_fn: &mut dyn FnMut(&InternalNode, IR) -> (NodeId, IR),
        leaf_fn: &mut dyn FnMut(&LeafNode, IR) -> LR,
        initial: IR,
    ) -> LR {
        self.walk(&self.top_node(), initial, internal_node_fn, leaf_fn)
    }
pub fn tree_walk < IR , LR > ( & self , internal_node_fn : & mut dyn FnMut ( & InternalNode , IR ) -> ( NodeId , IR ) , leaf_fn : & mut dyn FnMut ( & LeafNode , IR ) -> LR , initial : IR , ) -> LR { self . walk ( & self . top_node ( ) , initial , internal_node_fn , leaf_fn ) }
Walk from tree to a leaf.
Walk from tree to a leaf .
&self
internal_node_fn
&mut dyn FnMut(&InternalNode, IR) -> (NodeId, IR)
leaf_fn
&mut dyn FnMut(&LeafNode, IR) -> LR
initial
IR