From db4c329aff4621e05b92a55be4f18173f5a4f655 Mon Sep 17 00:00:00 2001 From: Joel Martin Date: Thu, 17 Apr 2014 21:49:07 -0500 Subject: 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 --- ruby/core.rb | 1 + ruby/stepA_more.rb | 1 + 2 files changed, 2 insertions(+) (limited to 'ruby') 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)))))))"] -- cgit v1.2.3