diff options
Diffstat (limited to 'ps')
| -rw-r--r-- | ps/core.ps | 3 | ||||
| -rw-r--r-- | ps/env.ps | 2 | ||||
| -rw-r--r-- | ps/printer.ps | 2 | ||||
| -rw-r--r-- | ps/reader.ps | 2 | ||||
| -rw-r--r-- | ps/step7_quote.ps | 2 | ||||
| -rw-r--r-- | ps/step8_macros.ps | 2 | ||||
| -rw-r--r-- | ps/step9_interop.ps | 2 | ||||
| -rw-r--r-- | ps/stepA_more.ps | 3 | ||||
| -rw-r--r-- | ps/types.ps | 2 |
9 files changed, 6 insertions, 14 deletions
@@ -1,5 +1,3 @@ -(in core.ps\n) print - % requires types.ps % Errors/Exceptions @@ -239,6 +237,7 @@ end } def (-) { dup 0 _nth exch 1 _nth sub } (*) { dup 0 _nth exch 1 _nth mul } (/) { dup 0 _nth exch 1 _nth idiv } + (time-ms) { pop realtime } (list) { /data get _list_from_array } (list?) { 0 _nth _list? } @@ -1,5 +1,3 @@ -(in env.ps\n) print - % outer binds exprs -> env_new -> new_env /env_new { 3 dict begin %(in env_new\n) print diff --git a/ps/printer.ps b/ps/printer.ps index de91d80..3062e2d 100644 --- a/ps/printer.ps +++ b/ps/printer.ps @@ -1,5 +1,3 @@ -(in printer.ps\n) print - % requires types.ps to be included first % ast print_readably -> _pr_str -> string diff --git a/ps/reader.ps b/ps/reader.ps index 188a121..f1f63f6 100644 --- a/ps/reader.ps +++ b/ps/reader.ps @@ -1,5 +1,3 @@ -(in reader\n) print - % requires types.ps to be included first /token_delim (;,"` \n{}\(\)[]) def diff --git a/ps/step7_quote.ps b/ps/step7_quote.ps index f335683..93bf464 100644 --- a/ps/step7_quote.ps +++ b/ps/step7_quote.ps @@ -17,7 +17,7 @@ % is_pair?: ast -> is_pair? -> bool % return true if non-empty list, otherwise false /is_pair? { - dup _list? { _count 0 gt }{ pop false } ifelse + dup _sequential? { _count 0 gt }{ pop false } ifelse } def % ast -> quasiquote -> new_ast diff --git a/ps/step8_macros.ps b/ps/step8_macros.ps index 87fafb1..814b62b 100644 --- a/ps/step8_macros.ps +++ b/ps/step8_macros.ps @@ -17,7 +17,7 @@ % is_pair?: ast -> is_pair? -> bool % return true if non-empty list, otherwise false /is_pair? { - dup _list? { _count 0 gt }{ pop false } ifelse + dup _sequential? { _count 0 gt }{ pop false } ifelse } def % ast -> quasiquote -> new_ast diff --git a/ps/step9_interop.ps b/ps/step9_interop.ps index fbf51a5..e8d837f 100644 --- a/ps/step9_interop.ps +++ b/ps/step9_interop.ps @@ -17,7 +17,7 @@ % is_pair?: ast -> is_pair? -> bool % return true if non-empty list, otherwise false /is_pair? { - dup _list? { _count 0 gt }{ pop false } ifelse + dup _sequential? { _count 0 gt }{ pop false } ifelse } def % ast -> quasiquote -> new_ast diff --git a/ps/stepA_more.ps b/ps/stepA_more.ps index 1720b94..73403b0 100644 --- a/ps/stepA_more.ps +++ b/ps/stepA_more.ps @@ -17,7 +17,7 @@ % is_pair?: ast -> is_pair? -> bool % return true if non-empty list, otherwise false /is_pair? { - dup _list? { _count 0 gt }{ pop false } ifelse + dup _sequential? { _count 0 gt }{ pop false } ifelse } def % ast -> quasiquote -> new_ast @@ -252,6 +252,7 @@ core_ns { _ref } forall (eval) { 0 _nth repl_env EVAL } _ref % core.mal: defined using the language itself +(\(def! *host-language* "postscript"\)) RE pop (\(def! not \(fn* \(a\) \(if a false true\)\)\)) RE pop (\(def! load-file \(fn* \(f\) \(eval \(read-string \(str "\(do " \(slurp f\) "\)"\)\)\)\)\)) RE pop (\(defmacro! cond \(fn* \(& xs\) \(if \(> \(count xs\) 0\) \(list 'if \(first xs\) \(if \(> \(count xs\) 1\) \(nth xs 1\) \(throw "odd number of forms to cond"\)\) \(cons 'cond \(rest \(rest xs\)\)\)\)\)\)\)) RE pop diff --git a/ps/types.ps b/ps/types.ps index 2b26582..82be9c2 100644 --- a/ps/types.ps +++ b/ps/types.ps @@ -1,5 +1,3 @@ -(in types.ps\n) print - % General functions % concatenate: concatenate two strings or two arrays |
