use std::collections::HashSet;
use im::Vector as IMVector;
use crate::*;
mod iter;
mod func;
#[derive(Clone, Copy, Hash, PartialEq, Eq, Debug, GcCompat, PartialOrd, Ord)]
pub struct List<T: Obj>(pub(crate) GcCow<IMVector<T>>);
pub macro list {
() => { List::new() },
($start:expr $(,$a:expr)*) => { [$start $(,$a)* ].into_iter().collect::<List<_>>() },
($a:expr ; $b:expr) => { List::from_elem($a, Int::from($b)) },
}
impl<T: Obj> GcCompat for IMVector<T> {
fn points_to(&self, m: &mut HashSet<usize>) {
for i in self.iter() {
i.points_to(m);
}
}
}
impl<T: Obj> Default for List<T> {
fn default() -> Self {
Self(Default::default())
}
}