}
}
}
impl<'gc> ConsCell<'gc> {
/// Checks if this cell represents an empty list.
pub fn is_empty_list(&self) -> bool {
self.car.is_none() && self.cdr.is_none()
}
/// Checks if this cell is a list
pub fn is_list(&self) -> bool {
if let Some(cdr) = self.cdr.as_ref() {
matches!(cdr.as_ref(), Primitive::List(_))
} else {
// We are a list by virtue of resembling the empty list.
// Technically we have 2 representations of "empty list"
// - a cdr pointer of None (the pointed empty list)
// - a ConsCell with both car and cdr set to None (the object empty list)
true