diff options
Diffstat (limited to 'rust/src/types.rs')
| -rw-r--r-- | rust/src/types.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/rust/src/types.rs b/rust/src/types.rs index 3e0e027..75aecbc 100644 --- a/rust/src/types.rs +++ b/rust/src/types.rs @@ -14,10 +14,16 @@ pub enum MalType { List(Vec<MalVal>), Vector(Vec<MalVal>), HashMap(collections::HashMap<String, MalVal>), + Func(fn(Vec<MalVal>) -> MalRet), + //Func(fn(&[MalVal]) -> MalRet), + //Func(|Vec<MalVal>|:'a -> MalRet), } pub type MalVal = Rc<MalType>; +pub type MalRet = Result<MalVal,String>; + + impl MalType { pub fn pr_str(&self, print_readably: bool) -> String { let _r = print_readably; @@ -44,8 +50,11 @@ impl MalType { } res.push_str(")") } -/* -*/ + // TODO: better function representation + //Func(ref v) => { + Func(_) => { + res.push_str(format!("#<function ...>").as_slice()) + } /* Vector(ref v) => { let mut first = true; |
