diff options
| author | Joel Martin <github@martintribe.org> | 2014-04-16 23:57:50 -0500 |
|---|---|---|
| committer | Joel Martin <github@martintribe.org> | 2014-04-16 23:57:50 -0500 |
| commit | 8cb5cda46cf3aef847ae3926dc53a5e5f87fe261 (patch) | |
| tree | 13e5b2878f19ee24272ead8a92a9cb84b33ad0e5 /cs/step2_eval.cs | |
| parent | a05f7822b10ed4cdd61ed8384299a003baf1c1c6 (diff) | |
| download | mal-8cb5cda46cf3aef847ae3926dc53a5e5f87fe261.tar.gz mal-8cb5cda46cf3aef847ae3926dc53a5e5f87fe261.zip | |
All: move some fns to core. Major cleanup.
- Don't import/require core until step4.
- Define cond/or macros from step8
Diffstat (limited to 'cs/step2_eval.cs')
| -rw-r--r-- | cs/step2_eval.cs | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/cs/step2_eval.cs b/cs/step2_eval.cs index 09bf36d..dc467de 100644 --- a/cs/step2_eval.cs +++ b/cs/step2_eval.cs @@ -53,13 +53,13 @@ namespace Mal { // apply list MalList ast = (MalList)orig_ast; if (ast.size() == 0) { return ast; } - a0 = ast.nth(0); + a0 = ast[0]; if (!(a0 is MalSymbol)) { throw new Mal.types.MalError("attempt to apply on non-symbol '" + Mal.printer._pr_str(a0,true) + "'"); } var el = (MalList)eval_ast(ast, env); - var f = (MalFunction)el.nth(0); + var f = (MalFunction)el[0]; return f.apply(el.rest()); } @@ -92,10 +92,10 @@ namespace Mal { {"*", multiply}, {"/", divide}, }; + if (args.Length > 0 && args[0] == "--raw") { Mal.readline.mode = Mal.readline.Mode.Raw; } - while (true) { string line; try { @@ -109,14 +109,9 @@ namespace Mal { Console.WriteLine(PRINT(RE(repl_env, line))); } catch (Mal.types.MalContinue) { continue; - } catch (Mal.reader.ParseError e) { - Console.WriteLine(e.Message); - continue; - } catch (Mal.types.MalError e) { - Console.WriteLine("Error: " + e.Message); - continue; } catch (Exception e) { Console.WriteLine("Error: " + e.Message); + Console.WriteLine(e.StackTrace); continue; } } |
