aboutsummaryrefslogtreecommitdiff
path: root/ruby/step2_eval.rb
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2014-04-13 15:27:34 -0500
committerJoel Martin <github@martintribe.org>2014-04-13 15:27:34 -0500
commit3e8a088f48ea6030191c15457aafdd1b30387ca0 (patch)
tree84c761774ae26e14f1bd056ab3d8511e1d002d53 /ruby/step2_eval.rb
parent3a56f91a12ccad642227178c76f8d76cc42f81ee (diff)
downloadmal-3e8a088f48ea6030191c15457aafdd1b30387ca0.tar.gz
mal-3e8a088f48ea6030191c15457aafdd1b30387ca0.zip
Ruby: fixes to enable self-hosting.
Also, other cleanup and sync between steps.
Diffstat (limited to 'ruby/step2_eval.rb')
-rw-r--r--ruby/step2_eval.rb6
1 files changed, 6 insertions, 0 deletions
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