diff options
| author | Joel Martin <github@martintribe.org> | 2014-10-27 22:39:31 -0500 |
|---|---|---|
| committer | Joel Martin <github@martintribe.org> | 2015-01-06 21:59:00 -0600 |
| commit | bd3067230dcbd18fb1f0db7abb52c4ea1c2e227b (patch) | |
| tree | 08c01aaacbc469ea4d1ad950852bf67aeb4cdcae /rust/src/step6_file.rs | |
| parent | 06fef9b51830a2aa696f3e108c56f306967ce465 (diff) | |
| download | mal-bd3067230dcbd18fb1f0db7abb52c4ea1c2e227b.tar.gz mal-bd3067230dcbd18fb1f0db7abb52c4ea1c2e227b.zip | |
rust: add metadata support.
Diffstat (limited to 'rust/src/step6_file.rs')
| -rw-r--r-- | rust/src/step6_file.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/rust/src/step6_file.rs b/rust/src/step6_file.rs index 86e0672..3503653 100644 --- a/rust/src/step6_file.rs +++ b/rust/src/step6_file.rs @@ -31,7 +31,7 @@ fn eval_ast(ast: MalVal, env: Env) -> MalRet { Sym(ref sym) => { env_get(env.clone(), sym.clone()) }, - List(ref a) | Vector(ref a) => { + List(ref a,_) | Vector(ref a,_) => { let mut ast_vec : Vec<MalVal> = vec![]; for mv in a.iter() { let mv2 = mv.clone(); @@ -40,10 +40,10 @@ fn eval_ast(ast: MalVal, env: Env) -> MalRet { Err(e) => { return Err(e); }, } } - Ok(match *ast { List(_) => list(ast_vec), + Ok(match *ast { List(_,_) => list(ast_vec), _ => vector(ast_vec) }) }, - Hash_Map(ref hm) => { + Hash_Map(ref hm,_) => { let mut new_hm: HashMap<String,MalVal> = HashMap::new(); for (key, value) in hm.iter() { match eval(value.clone(), env.clone()) { @@ -67,18 +67,18 @@ fn eval(mut ast: MalVal, mut env: Env) -> MalRet { let ast2 = ast.clone(); let ast3 = ast.clone(); match *ast2 { - List(_) => (), // continue + List(_,_) => (), // continue _ => return eval_ast(ast2, env), } // apply list match *ast2 { - List(_) => (), // continue + List(_,_) => (), // continue _ => return Ok(ast2), } let (args, a0sym) = match *ast2 { - List(ref args) => { + List(ref args,_) => { if args.len() == 0 { return Ok(ast3); } @@ -116,7 +116,7 @@ fn eval(mut ast: MalVal, mut env: Env) -> MalRet { let a1 = (*args)[1].clone(); let a2 = (*args)[2].clone(); match *a1 { - List(ref binds) | Vector(ref binds) => { + List(ref binds,_) | Vector(ref binds,_) => { let mut it = binds.iter(); while it.len() >= 2 { let b = it.next().unwrap(); @@ -183,7 +183,7 @@ fn eval(mut ast: MalVal, mut env: Env) -> MalRet { "fn*" => { let a1 = (*args)[1].clone(); let a2 = (*args)[2].clone(); - return Ok(malfunc(eval, a2, env.clone(), a1)); + return Ok(malfunc(eval, a2, env.clone(), a1, _nil())); }, "eval" => { let a1 = (*args)[1].clone(); @@ -201,12 +201,12 @@ fn eval(mut ast: MalVal, mut env: Env) -> MalRet { Err(e) => Err(e), Ok(el) => { let args = match *el { - List(ref args) => args, + List(ref args,_) => args, _ => return err_str("Invalid apply"), }; match *args.clone()[0] { - Func(f) => f(args.slice(1,args.len()).to_vec()), - MalFunc(ref mf) => { + Func(f,_) => f(args.slice(1,args.len()).to_vec()), + MalFunc(ref mf,_) => { let mfc = mf.clone(); let alst = list(args.slice(1,args.len()).to_vec()); let new_env = env_new(Some(mfc.env.clone())); |
