aboutsummaryrefslogtreecommitdiff
path: root/rust/src/types.rs
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2014-10-25 12:41:24 -0500
committerJoel Martin <github@martintribe.org>2015-01-06 21:58:57 -0600
commit0ab374bc261f871ab8fbbc13e0096f44225e2a3f (patch)
tree18bf694e55ee767e5d55edf73819affa3f0214b5 /rust/src/types.rs
parentabdd56ebc0e01cd92f694ef2bcafcc394453d055 (diff)
downloadmal-0ab374bc261f871ab8fbbc13e0096f44225e2a3f.tar.gz
mal-0ab374bc261f871ab8fbbc13e0096f44225e2a3f.zip
rust: add step2_eval.
Diffstat (limited to 'rust/src/types.rs')
-rw-r--r--rust/src/types.rs13
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;