pub fn intersect(&self, other: &Environment) -> Environment {
        let keys = self.vars.keys().filter(|key| other.vars.contains_key(*key));
        let mut vars = HashMap::new();
        for key in keys {
            match (self.vars.get(key), other.vars.get(key)) {
                (Some(l_exp), Some(r_exp)) => {
                    let union = l_exp.union(r_exp);
                    vars.insert(String::from(key), HashSet::from_iter(union.cloned()));
                }
                (Some(exp), None) | (None, Some(exp)) => {
                    vars.insert(String::from(key), exp.clone());
                }
                _ => {}
            }
        }

        Environment { vars, ..self.clone() }
    }
/// Intersection between two environments.
///
/// If both environments contain the same variable, variable gets assigned
/// both the expected. Variables that are only present in one of the
/// environments are discarded.
///
/// Only intersect vars, all other fields of other environment are
/// discarded.
Intersection between two environments.
If both environments contain the same variable, variable gets assigned
both the expected. Variables that are only present in one of the
environments are discarded.

Only intersect vars, all other fields of other environment are
discarded.
Intersection between two environments . If both environments contain the same variable variable gets assigned both the expected . Variables that are only present in one of the environments are discarded . Only intersect vars all other fields of other environment are discarded .
pub fn intersect(&self, other: &Environment) -> Environment {
        let keys = self.vars.keys().filter(|key| other.vars.contains_key(*key));
        let mut vars = HashMap::new();
        for key in keys {
            match (self.vars.get(key), other.vars.get(key)) {
                (Some(l_exp), Some(r_exp)) => {
                    let union = l_exp.union(r_exp);
                    vars.insert(String::from(key), HashSet::from_iter(union.cloned()));
                }
                (Some(exp), None) | (None, Some(exp)) => {
                    vars.insert(String::from(key), exp.clone());
                }
                _ => {}
            }
        }
        Environment { vars, ..self.clone() }
    }
pub fn intersect ( & self , other : & Environment ) -> Environment { let keys = self . vars . keys ( ) . filter ( | key | other . vars . contains_key ( * key ) ) ; let mut vars = HashMap :: new ( ) ; for key in keys { match ( self . vars . get ( key ) , other . vars . get ( key ) ) { ( Some ( l_exp ) , Some ( r_exp ) ) => { let union = l_exp . union ( r_exp ) ; vars . insert ( String :: from ( key ) , HashSet :: from_iter ( union . cloned ( ) ) ) ; } ( Some ( exp ) , None ) | ( None , Some ( exp ) ) => { vars . insert ( String :: from ( key ) , exp . clone ( ) ) ; } _ => { } } } Environment { vars , .. self . clone ( ) } }
Intersection between two environments.
Intersection between two environments .
&self
other
&Environment