aboutsummaryrefslogtreecommitdiff
path: root/php/step7_quote.php
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2014-04-19 13:04:09 -0500
committerJoel Martin <github@martintribe.org>2014-04-19 13:04:09 -0500
commit86b689f3d7111a9fa13da389a30f3dfdf877d1a4 (patch)
treed72b065f9f987e291f892ceee5a8640363bfd9df /php/step7_quote.php
parent718887c3019c49fc807bc18fbd5feb975ec03c85 (diff)
downloadmal-86b689f3d7111a9fa13da389a30f3dfdf877d1a4.tar.gz
mal-86b689f3d7111a9fa13da389a30f3dfdf877d1a4.zip
All: *ARGV* and *host-language*. Misc syncing/fixes.
Diffstat (limited to 'php/step7_quote.php')
-rw-r--r--php/step7_quote.php12
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);
-?>
+?>