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 /ps/step6_file.ps | |
| parent | 718887c3019c49fc807bc18fbd5feb975ec03c85 (diff) | |
| download | mal-86b689f3d7111a9fa13da389a30f3dfdf877d1a4.tar.gz mal-86b689f3d7111a9fa13da389a30f3dfdf877d1a4.zip | |
All: *ARGV* and *host-language*. Misc syncing/fixes.
Diffstat (limited to 'ps/step6_file.ps')
| -rw-r--r-- | ps/step6_file.ps | 18 |
1 files changed, 11 insertions, 7 deletions
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 |
