aboutsummaryrefslogtreecommitdiff
path: root/ps/step6_file.ps
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2014-04-16 23:57:50 -0500
committerJoel Martin <github@martintribe.org>2014-04-16 23:57:50 -0500
commit8cb5cda46cf3aef847ae3926dc53a5e5f87fe261 (patch)
tree13e5b2878f19ee24272ead8a92a9cb84b33ad0e5 /ps/step6_file.ps
parenta05f7822b10ed4cdd61ed8384299a003baf1c1c6 (diff)
downloadmal-8cb5cda46cf3aef847ae3926dc53a5e5f87fe261.tar.gz
mal-8cb5cda46cf3aef847ae3926dc53a5e5f87fe261.zip
All: move some fns to core. Major cleanup.
- Don't import/require core until step4. - Define cond/or macros from step8
Diffstat (limited to 'ps/step6_file.ps')
-rw-r--r--ps/step6_file.ps8
1 files changed, 3 insertions, 5 deletions
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