in progress commit
- fixed errors in func and vars blocking testing - use box references in call and eval Still need to fix the tests themselves....
This commit is contained in:
parent
d2f60314f9
commit
76b12a8214
5 changed files with 44 additions and 63 deletions
17
src/vars.rs
17
src/vars.rs
|
|
@ -21,14 +21,12 @@ use crate::cell::{Ctr};
|
|||
|
||||
/* Mapping between a string token and a tree of Cells
|
||||
* The string token can be found in any Ctr::Symbol value
|
||||
*
|
||||
* Considerations: should I use a structure of cells for this?
|
||||
* Current thoughts: if this was a language without proper data types, yes.
|
||||
* it is expected that the trees stored are already evaluated
|
||||
*/
|
||||
pub type VTable = HashMap<String, Box<Ctr>>;
|
||||
|
||||
pub fn define(
|
||||
vt: Box<VTable>,
|
||||
vt: &mut Box<VTable>,
|
||||
identifier: String,
|
||||
var_tree: Box<Ctr>
|
||||
) {
|
||||
|
|
@ -36,14 +34,3 @@ pub fn define(
|
|||
drop(boxed_cell);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get(
|
||||
vt: Box<VTable>,
|
||||
identifier: String
|
||||
) -> Option<Box<Ctr>> {
|
||||
if let Some(c) = vt.get(&identifier) {
|
||||
Some(*c)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue