Add "!" syntatic form - a bit like the single quote, but !(a b c) d => !(a b c d). Useful for like !(let a 1) (+ a 3) or w/e. Break out some of the infinate nesting"

This commit is contained in:
2023-02-10 01:01:04 -05:00
parent 3b5cc2c506
commit ba67b8c67b
3 changed files with 18 additions and 6 deletions

View File

@@ -55,5 +55,12 @@ impl Form {
_ => None,
}
}
pub fn append(&self, x: Rc<Form>) -> Option<Form> {
match self {
Form::Pair(car, cdr) => cdr.append(x).map(|x| Form::Pair(Rc::clone(car), Rc::new(x))),
Form::Nil => Some(Form::Pair(x, Rc::new(Form::Nil))),
_ => None,
}
}
}