diff options
Diffstat (limited to 'php/step7_quote.php')
| -rw-r--r-- | php/step7_quote.php | 12 |
1 files changed, 8 insertions, 4 deletions
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); -?> +?> |
