From 86b689f3d7111a9fa13da389a30f3dfdf877d1a4 Mon Sep 17 00:00:00 2001 From: Joel Martin Date: Sat, 19 Apr 2014 13:04:09 -0500 Subject: All: *ARGV* and *host-language*. Misc syncing/fixes. --- php/step7_quote.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'php/step7_quote.php') diff --git a/php/step7_quote.php b/php/step7_quote.php index 8296c1a..fd1c922 100644 --- a/php/step7_quote.php +++ b/php/step7_quote.php @@ -130,18 +130,22 @@ foreach ($core_ns as $k=>$v) { $repl_env->set('eval', _function(function($ast) { global $repl_env; return MAL_EVAL($ast, $repl_env); })); +$_argv = _list(); +for ($i=2; $i < count($argv); $i++) { + $_argv->append($argv[$i]); +} +$repl_env->set('*ARGV*', $_argv); // core.mal: defined using the language itself rep("(def! not (fn* (a) (if a false true)))"); rep("(def! load-file (fn* (f) (eval (read-string (str \"(do \" (slurp f) \")\")))))"); if (count($argv) > 1) { - for ($i=1; $i < count($argv); $i++) { - rep('(load-file "' . $argv[$i] . '")'); - } + rep('(load-file "' . $argv[1] . '")'); exit(0); } +// repl loop do { try { $line = mal_readline("user> "); @@ -157,4 +161,4 @@ do { } } while (true); -?> +?> -- cgit v1.2.3