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 /php/step9_interop.php | |
| parent | 718887c3019c49fc807bc18fbd5feb975ec03c85 (diff) | |
| download | mal-86b689f3d7111a9fa13da389a30f3dfdf877d1a4.tar.gz mal-86b689f3d7111a9fa13da389a30f3dfdf877d1a4.zip | |
All: *ARGV* and *host-language*. Misc syncing/fixes.
Diffstat (limited to 'php/step9_interop.php')
| -rw-r--r-- | php/step9_interop.php | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/php/step9_interop.php b/php/step9_interop.php index a46864c..f35244c 100644 --- a/php/step9_interop.php +++ b/php/step9_interop.php @@ -157,6 +157,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! not (fn* (a) (if a false true)))"); @@ -165,12 +170,11 @@ 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 do { try { $line = mal_readline("user> "); @@ -186,4 +190,4 @@ do { } } while (true); -?> +?> |
