add some boolean operations, tests for
Signed-off-by: Ava Hahn <ava@aidanis.online>
This commit is contained in:
parent
c1d83a6285
commit
28e158f110
5 changed files with 292 additions and 4 deletions
61
src/stl.rs
61
src/stl.rs
|
|
@ -23,6 +23,7 @@ use std::rc::Rc;
|
|||
|
||||
pub mod append;
|
||||
pub mod control;
|
||||
pub mod boolean;
|
||||
//pub mod str;
|
||||
|
||||
/// static_stdlib
|
||||
|
|
@ -79,6 +80,66 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
},
|
||||
);
|
||||
|
||||
syms.insert(
|
||||
"and".to_string(),
|
||||
Symbol {
|
||||
name: String::from("and"),
|
||||
args: Args::Infinite,
|
||||
conditional_branches: false,
|
||||
value: ValueType::Internal(Rc::new(boolean::bool_and_callback)),
|
||||
}
|
||||
);
|
||||
|
||||
syms.insert(
|
||||
"or".to_string(),
|
||||
Symbol {
|
||||
name: String::from("or"),
|
||||
args: Args::Infinite,
|
||||
conditional_branches: false,
|
||||
value: ValueType::Internal(Rc::new(boolean::bool_or_callback)),
|
||||
}
|
||||
);
|
||||
|
||||
syms.insert(
|
||||
"xor".to_string(),
|
||||
Symbol {
|
||||
name: String::from("xor"),
|
||||
args: Args::Infinite,
|
||||
conditional_branches: false,
|
||||
value: ValueType::Internal(Rc::new(boolean::bool_xor_callback)),
|
||||
}
|
||||
);
|
||||
|
||||
syms.insert(
|
||||
"not".to_string(),
|
||||
Symbol {
|
||||
name: String::from("not"),
|
||||
args: Args::Strict(vec![Type::Bool]),
|
||||
conditional_branches: false,
|
||||
value: ValueType::Internal(Rc::new(boolean::bool_not_callback)),
|
||||
}
|
||||
);
|
||||
|
||||
syms.insert(
|
||||
"eq?".to_string(),
|
||||
Symbol {
|
||||
name: String::from("eq?"),
|
||||
args: Args::Infinite,
|
||||
conditional_branches: false,
|
||||
value: ValueType::Internal(Rc::new(boolean::bool_iseq_callback)),
|
||||
}
|
||||
);
|
||||
|
||||
syms.insert(
|
||||
"toggle".to_string(),
|
||||
Symbol {
|
||||
name: String::from("toggle"),
|
||||
args: Args::Lazy(1),
|
||||
conditional_branches: true,
|
||||
value: ValueType::Internal(Rc::new(boolean::bool_toggle_callback)),
|
||||
}
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue