From 8cb5cda46cf3aef847ae3926dc53a5e5f87fe261 Mon Sep 17 00:00:00 2001 From: Joel Martin Date: Wed, 16 Apr 2014 23:57:50 -0500 Subject: All: move some fns to core. Major cleanup. - Don't import/require core until step4. - Define cond/or macros from step8 --- ps/step6_file.ps | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'ps/step6_file.ps') diff --git a/ps/step6_file.ps b/ps/step6_file.ps index fc12cc1..faa7101 100644 --- a/ps/step6_file.ps +++ b/ps/step6_file.ps @@ -121,15 +121,13 @@ end } def /RE { READ repl_env EVAL } def /REP { READ repl_env EVAL PRINT } def -/_ref { _function repl_env 3 1 roll env_set pop } def +% core.ps: defined using postscript +/_ref { _function repl_env 3 1 roll env_set pop } def core_ns { _ref } forall - -(read-string) { 0 _nth read_str } _ref (eval) { 0 _nth repl_env EVAL } _ref -/slurp { (r) file dup bytesavailable string readstring pop } def -(slurp) { 0 _nth slurp } _ref +% core.mal: defined using the language itself (\(def! not \(fn* \(a\) \(if a false true\)\)\)) RE pop (\(def! load-file \(fn* \(f\) \(eval \(read-string \(str "\(do " \(slurp f\) "\)"\)\)\)\)\)) RE pop -- cgit v1.2.3