pub fn extract(eclass: Id, egraph: &crate::EGraph) -> Expr {
    debug_assert!(egraph[eclass].nodes.len() == 1);
    match &egraph[eclass].nodes[0] {
        Lambda::Prim(p) => Expr::prim(*p),
        Lambda::Var(i) => Expr::var(*i),
        Lambda::IVar(i) => Expr::ivar(*i),
        Lambda::App([f,x]) => Expr::app(extract(*f,egraph), extract(*x,egraph)),
        Lambda::Lam([b]) => Expr::lam(extract(*b,egraph)),
        Lambda::Programs(roots) => Expr::programs(roots.iter().map(|r| extract(*r,egraph)).collect()),
    }
}
/// convert an egraph Id to an Expr. Assumes one node per class (just picks the first node). Note
/// that this could cause an infinite loop if the egraph didnt just have a single node in a class
/// and instead the first node had a self loop.
convert an egraph Id to an Expr. Assumes one node per class (just picks the first node). Note
that this could cause an infinite loop if the egraph didnt just have a single node in a class
and instead the first node had a self loop.
convert an egraph Id to an Expr . Assumes one node per class ( just picks the first node ) . Note that this could cause an infinite loop if the egraph didnt just have a single node in a class and instead the first node had a self loop .
pub fn extract(eclass: Id, egraph: &crate::EGraph) -> Expr {
    debug_assert!(egraph[eclass].nodes.len() == 1);
    match &egraph[eclass].nodes[0] {
        Lambda::Prim(p) => Expr::prim(*p),
        Lambda::Var(i) => Expr::var(*i),
        Lambda::IVar(i) => Expr::ivar(*i),
        Lambda::App([f,x]) => Expr::app(extract(*f,egraph), extract(*x,egraph)),
        Lambda::Lam([b]) => Expr::lam(extract(*b,egraph)),
        Lambda::Programs(roots) => Expr::programs(roots.iter().map(|r| extract(*r,egraph)).collect()),
    }
}
pub fn extract ( eclass : Id , egraph : & crate :: EGraph ) -> Expr { debug_assert ! ( egraph [ eclass ] nodes len ( ) 1 ) ; match & egraph [ eclass ] . nodes [ 0 ] { Lambda :: Prim ( p ) => Expr :: prim ( * p ) , Lambda :: Var ( i ) => Expr :: var ( * i ) , Lambda :: IVar ( i ) => Expr :: ivar ( * i ) , Lambda :: App ( [ f , x ] ) => Expr :: app ( extract ( * f , egraph ) , extract ( * x , egraph ) ) , Lambda :: Lam ( [ b ] ) => Expr :: lam ( extract ( * b , egraph ) ) , Lambda :: Programs ( roots ) => Expr :: programs ( roots . iter ( ) . map ( | r | extract ( * r , egraph ) ) . collect ( ) ) , } }
convert an egraph Id to an Expr.
convert an egraph Id to an Expr .
eclass
Id
egraph
&crate::EGraph
eclass
Id
egraph
&crate::EGraph