diff options
| author | Joel Martin <github@martintribe.org> | 2014-04-19 13:04:09 -0500 |
|---|---|---|
| committer | Joel Martin <github@martintribe.org> | 2014-04-19 13:04:09 -0500 |
| commit | 86b689f3d7111a9fa13da389a30f3dfdf877d1a4 (patch) | |
| tree | d72b065f9f987e291f892ceee5a8640363bfd9df /ruby/step9_interop.rb | |
| parent | 718887c3019c49fc807bc18fbd5feb975ec03c85 (diff) | |
| download | mal-86b689f3d7111a9fa13da389a30f3dfdf877d1a4.tar.gz mal-86b689f3d7111a9fa13da389a30f3dfdf877d1a4.zip | |
All: *ARGV* and *host-language*. Misc syncing/fixes.
Diffstat (limited to 'ruby/step9_interop.rb')
| -rw-r--r-- | ruby/step9_interop.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/ruby/step9_interop.rb b/ruby/step9_interop.rb index 2c56de4..507114e 100644 --- a/ruby/step9_interop.rb +++ b/ruby/step9_interop.rb @@ -138,6 +138,7 @@ REP = lambda {|str| PRINT(EVAL(READ(str), repl_env)) } # 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)}) +repl_env.set(:"*ARGV*", List.new(ARGV.slice(1,ARGV.length) || [])) # core.mal: defined using the language itself RE["(def! not (fn* (a) (if a false true)))"] @@ -146,11 +147,11 @@ RE["(defmacro! cond (fn* (& xs) (if (> (count xs) 0) (list 'if (first xs) (if (> RE["(defmacro! or (fn* (& xs) (if (empty? xs) nil (if (= 1 (count xs)) (first xs) `(let* (or_FIXME ~(first xs)) (if or_FIXME or_FIXME (or ~@(rest xs))))))))"] if ARGV.size > 0 - ARGV.each {|f| - RE["(load-file \"" + f + "\")"] - } + RE["(load-file \"" + ARGV[0] + "\")"] exit 0 end + +# repl loop while line = _readline("user> ") begin puts REP[line] |
