All: *ARGV* and *host-language*. Misc syncing/fixes.
[jackhill/mal.git] / ps / step9_interop.ps
index e8d837f..4f324d5 100644 (file)
@@ -211,9 +211,10 @@ end } def
 /REP { READ repl_env EVAL PRINT } def
 
 % core.ps: defined using postscript
-/_ref { _function repl_env 3 1 roll env_set pop } def
-core_ns { _ref } forall
-(eval) { 0 _nth repl_env EVAL } _ref
+/_ref { repl_env 3 1 roll env_set pop } def
+core_ns { _function _ref } forall
+(eval) { 0 _nth repl_env EVAL } _function _ref
+(*ARGV*) [ ] _list_from_array _ref
 
 % core.mal: defined using the language itself
 (\(def! not \(fn* \(a\) \(if a false true\)\)\)) RE pop
@@ -223,13 +224,16 @@ core_ns { _ref } forall
 
 userdict /ARGUMENTS known { %if command line arguments
     ARGUMENTS length 0 gt { %if more than 0 arguments
-        ARGUMENTS {
-            (\(load-file ") exch ("\)) concatenate concatenate RE pop
-        } forall
+        (*ARGV*) ARGUMENTS 1 ARGUMENTS length 1 sub getinterval
+        _list_from_array _ref
+        ARGUMENTS 0 get 
+        (\(load-file ") exch ("\)) concatenate concatenate RE pop
         quit
     } if
 } if
-{ % loop
+
+% repl loop
+{ %loop
     (user> ) _readline
     not { exit } if  % exit if EOF