Fix ', add if and = along with bools

This commit is contained in:
2023-02-08 01:54:53 -05:00
parent c801f604c2
commit d861d91397
3 changed files with 39 additions and 11 deletions

View File

@@ -1,15 +1,23 @@
use std::rc::Rc;
#[derive(Debug)]
#[derive(Debug, Eq, PartialEq)]
pub enum Form {
Nil,
Int(i32),
Bool(bool),
Symbol(String),
Pair(Rc<Form>,Rc<Form>),
DeriComb { se: Rc<Form>, de: Option<String>, params: Rc<Form>, body: Rc<Form> },
PrimComb(String, fn(Rc<Form>, Rc<Form>) -> Rc<Form>),
Nil,
DeriComb { se: Rc<Form>, de: Option<String>, params: Rc<Form>, body: Rc<Form> },
}
impl Form {
pub fn truthy(&self) -> bool {
match self {
Form::Bool(b) => *b,
Form::Nil => false,
_ => true,
}
}
pub fn int(&self) -> Option<i32> {
match self {
Form::Int(i) => Some(*i),