From 3e8a088f48ea6030191c15457aafdd1b30387ca0 Mon Sep 17 00:00:00 2001 From: Joel Martin Date: Sun, 13 Apr 2014 15:27:34 -0500 Subject: Ruby: fixes to enable self-hosting. Also, other cleanup and sync between steps. --- ruby/step2_eval.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'ruby/step2_eval.rb') diff --git a/ruby/step2_eval.rb b/ruby/step2_eval.rb index 9cbae24..9318099 100644 --- a/ruby/step2_eval.rb +++ b/ruby/step2_eval.rb @@ -18,12 +18,18 @@ def eval_ast(ast, env) List.new ast.map{|a| EVAL(a, env)} when Vector Vector.new ast.map{|a| EVAL(a, env)} + when Hash + new_hm = {} + ast.each{|k,v| new_hm[EVAL(k,env)] = EVAL(v, env)} + new_hm else ast end end def EVAL(ast, env) + #puts "EVAL: #{_pr_str(ast, true)}" + if not ast.is_a? List return eval_ast(ast, env) end -- cgit v1.2.3