aboutsummaryrefslogtreecommitdiff
path: root/php/stepA_more.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/stepA_more.php
parent718887c3019c49fc807bc18fbd5feb975ec03c85 (diff)
downloadmal-86b689f3d7111a9fa13da389a30f3dfdf877d1a4.tar.gz
mal-86b689f3d7111a9fa13da389a30f3dfdf877d1a4.zip
All: *ARGV* and *host-language*. Misc syncing/fixes.
Diffstat (limited to 'php/stepA_more.php')
-rw-r--r--php/stepA_more.php13
1 files changed, 9 insertions, 4 deletions
diff --git a/php/stepA_more.php b/php/stepA_more.php
index 2eae095..0f4c8ae 100644
--- a/php/stepA_more.php
+++ b/php/stepA_more.php
@@ -175,6 +175,11 @@ 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! *host-language* \"php\")");
@@ -184,12 +189,12 @@ rep("(defmacro! cond (fn* (& xs) (if (> (count xs) 0) (list 'if (first xs) (if (
rep("(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 (count($argv) > 1) {
- for ($i=1; $i < count($argv); $i++) {
- rep('(load-file "' . $argv[$i] . '")');
- }
+ rep('(load-file "' . $argv[1] . '")');
exit(0);
}
+// repl loop
+rep("(println (str \"Mal [\" *host-language* \"]\"))");
do {
try {
$line = mal_readline("user> ");
@@ -205,4 +210,4 @@ do {
}
} while (true);
-?>
+?>