aboutsummaryrefslogtreecommitdiff
path: root/ruby/step5_tco.rb
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2014-04-16 23:57:50 -0500
committerJoel Martin <github@martintribe.org>2014-04-16 23:57:50 -0500
commit8cb5cda46cf3aef847ae3926dc53a5e5f87fe261 (patch)
tree13e5b2878f19ee24272ead8a92a9cb84b33ad0e5 /ruby/step5_tco.rb
parenta05f7822b10ed4cdd61ed8384299a003baf1c1c6 (diff)
downloadmal-8cb5cda46cf3aef847ae3926dc53a5e5f87fe261.tar.gz
mal-8cb5cda46cf3aef847ae3926dc53a5e5f87fe261.zip
All: move some fns to core. Major cleanup.
- Don't import/require core until step4. - Define cond/or macros from step8
Diffstat (limited to 'ruby/step5_tco.rb')
-rw-r--r--ruby/step5_tco.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/ruby/step5_tco.rb b/ruby/step5_tco.rb
index 0b28a09..c6b5782 100644
--- a/ruby/step5_tco.rb
+++ b/ruby/step5_tco.rb
@@ -86,12 +86,12 @@ end
repl_env = Env.new
RE = lambda {|str| EVAL(READ(str), repl_env) }
REP = lambda {|str| PRINT(EVAL(READ(str), repl_env)) }
-_ref = lambda {|k,v| repl_env.set(k, v) }
-# Import core functions
-$core_ns.each &_ref
+# core.rb: defined using ruby
+$core_ns.each do |k,v| repl_env.set(k,v) end
+repl_env.set(:eval, lambda {|ast| EVAL(ast, repl_env)})
-# Defined using the language itself
+# core.mal: defined using the language itself
RE["(def! not (fn* (a) (if a false true)))"]
while line = Readline.readline("user> ", true)