@@ -2,7 +2,7 @@
extern crate void;
use std::cmp::Ordering;
-use std::collections::HashMap;
+use std::collections::{HashMap, HashSet};
use std::hash::Hash;
mod eval;
@@ -30,7 +30,7 @@
}
/// Convenience type, maps an instance of a type to an Arc containing a clone of the instance.
-type SelfMap<T> = HashMap<T, Container<T>>;
+type SelfMap<T> = HashSet<Container<T>>;
/// A struct that contains canonicalization maps for every node type, as well as maps to
/// memoize partial derivatives.
@@ -379,12 +379,11 @@
fn insert(&self, env: &mut Environment<T>) -> Container<Self>
where Self: Sized + Clone + Eq + Hash
{
- if !self.get_storage(env).contains_key(self) {
+ if !self.get_storage(env).contains(self) {
let key = self.fancy_clone(env);
- let value = key.clone();
- self.get_storage(env).insert(key, container(value));
+ self.get_storage(env).insert(container(key));
}
- self.get_storage(env)[self].clone()
+ self.get_storage(env).get(self).unwrap().clone()
}
}
Comments