diff options
| author | Joel Martin <github@martintribe.org> | 2014-04-17 21:49:07 -0500 |
|---|---|---|
| committer | Joel Martin <github@martintribe.org> | 2014-04-17 21:49:07 -0500 |
| commit | db4c329aff4621e05b92a55be4f18173f5a4f655 (patch) | |
| tree | 92baaa6d88246e509cfd6a7d03d8fab997e0b935 /cs | |
| parent | 8cb5cda46cf3aef847ae3926dc53a5e5f87fe261 (diff) | |
| download | mal-db4c329aff4621e05b92a55be4f18173f5a4f655.tar.gz mal-db4c329aff4621e05b92a55be4f18173f5a4f655.zip | |
All: perf test, Makefile refactor, add *host-language*
Other:
- bash,make,postscript: quasiquote of vectors
- Fix Java slurp
- add time function to core.mal
- switches on *host-language* for make time-secs vs time-ms
- Ignore */experiments directories
Diffstat (limited to 'cs')
| -rw-r--r-- | cs/core.cs | 6 | ||||
| -rw-r--r-- | cs/stepA_more.cs | 1 |
2 files changed, 7 insertions, 0 deletions
@@ -36,6 +36,11 @@ namespace Mal { a => a[0] is MalSymbol ? True : False); + // Number functions + static MalFunction time_ms = new MalFunction( + a => new MalInteger((int)( + DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond))); + // String functions static public MalFunction pr_str = new MalFunction( a => new MalString(printer._pr_str_args(a, " ", true)) ); @@ -265,6 +270,7 @@ namespace Mal { {"-", new MalFunction(a => (MalInteger)a[0] - (MalInteger)a[1])}, {"*", new MalFunction(a => (MalInteger)a[0] * (MalInteger)a[1])}, {"/", new MalFunction(a => (MalInteger)a[0] / (MalInteger)a[1])}, + {"time-ms", time_ms}, {"list", new MalFunction(a => new MalList(a.getValue()))}, {"list?", list_Q}, diff --git a/cs/stepA_more.cs b/cs/stepA_more.cs index cbbc91f..dbbf53d 100644 --- a/cs/stepA_more.cs +++ b/cs/stepA_more.cs @@ -234,6 +234,7 @@ namespace Mal { repl_env.set("eval", new MalFunction(a => EVAL(a[0], repl_env))); // core.mal: defined using the language itself + RE(repl_env, "(def! *host-language* \"c#\")"); RE(repl_env, "(def! not (fn* (a) (if a false true)))"); RE(repl_env, "(def! load-file (fn* (f) (eval (read-string (str \"(do \" (slurp f) \")\")))))"); RE(repl_env, "(defmacro! cond (fn* (& xs) (if (> (count xs) 0) (list 'if (first xs) (if (> (count xs) 1) (nth xs 1) (throw \"odd number of forms to cond\")) (cons 'cond (rest (rest xs)))))))"); |
