From 86b689f3d7111a9fa13da389a30f3dfdf877d1a4 Mon Sep 17 00:00:00 2001 From: Joel Martin Date: Sat, 19 Apr 2014 13:04:09 -0500 Subject: All: *ARGV* and *host-language*. Misc syncing/fixes. --- ps/step6_file.ps | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'ps/step6_file.ps') diff --git a/ps/step6_file.ps b/ps/step6_file.ps index faa7101..00598be 100644 --- a/ps/step6_file.ps +++ b/ps/step6_file.ps @@ -123,9 +123,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 @@ -133,13 +134,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 -- cgit v1.2.3