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 /ruby | |
| 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 'ruby')
| -rw-r--r-- | ruby/core.rb | 1 | ||||
| -rw-r--r-- | ruby/stepA_more.rb | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/ruby/core.rb b/ruby/core.rb index c7fc8c3..6b127ba 100644 --- a/ruby/core.rb +++ b/ruby/core.rb @@ -26,6 +26,7 @@ $core_ns = { :- => lambda {|a,b| a - b}, :* => lambda {|a,b| a * b}, :/ => lambda {|a,b| a / b}, + :"time-ms" => lambda {|| (Time.now.to_f * 1000).to_i}, :list => lambda {|*a| List.new a}, :list? => lambda {|*a| a[0].is_a? List}, diff --git a/ruby/stepA_more.rb b/ruby/stepA_more.rb index 42eac5b..a2fc5cc 100644 --- a/ruby/stepA_more.rb +++ b/ruby/stepA_more.rb @@ -154,6 +154,7 @@ $core_ns.each do |k,v| repl_env.set(k,v) end repl_env.set(:eval, lambda {|ast| EVAL(ast, repl_env)}) # core.mal: defined using the language itself +RE["(def! *host-language* \"ruby\")"] RE["(def! not (fn* (a) (if a false true)))"] RE["(def! load-file (fn* (f) (eval (read-string (str \"(do \" (slurp f) \")\")))))"] RE["(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)))))))"] |
