aboutsummaryrefslogtreecommitdiff
path: root/ps/types.ps
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2014-03-30 22:39:44 -0500
committerJoel Martin <github@martintribe.org>2014-03-30 22:39:44 -0500
commit8e7e339db8060f95d27694b93b8d4d648d13c083 (patch)
tree53aeff225a82a2256970140d8792a8f5ed3d6fb8 /ps/types.ps
parent54c75382653d1bd4da7628c04aa9382af8add912 (diff)
downloadmal-8e7e339db8060f95d27694b93b8d4d648d13c083.tar.gz
mal-8e7e339db8060f95d27694b93b8d4d648d13c083.zip
PS: add step7_quote
Diffstat (limited to 'ps/types.ps')
-rw-r--r--ps/types.ps28
1 files changed, 26 insertions, 2 deletions
diff --git a/ps/types.ps b/ps/types.ps
index 0e530b5..a830108 100644
--- a/ps/types.ps
+++ b/ps/types.ps
@@ -113,9 +113,16 @@ end } def
} ifelse
end } def
+%
+% Symbols
+%
+/_symbol? {
+ type /nametype eq
+} def
+
%
-% errors/exceptions
+% Errors/Exceptions
%
% data -> throw ->
@@ -160,6 +167,9 @@ end } def
%
% list operations
%
+/_list {
+ array astore
+} def
/_list? {
dup xcheck not exch type /arraytype eq and
} def
@@ -167,6 +177,18 @@ end } def
/_rest { dup length 1 sub 1 exch getinterval } def
/_nth { get } def
+/_cons {
+ /lst exch def
+ /elem exch def
+ lst length 1 add array
+ dup 0 elem put % first element
+ dup 1 lst putinterval % rest of the elements
+} def
+
+/_concat {
+ concatenate
+} def
+
%
% Env implementation
@@ -246,8 +268,10 @@ end } def
(-) { dup 0 get exch 1 get sub }
(*) { dup 0 get exch 1 get mul }
(/) { dup 0 get exch 1 get idiv }
- (list) { }
+ (list) { dup pop } % noop
(list?) { 0 get _list? }
+ (cons) { dup 0 get exch 1 get _cons }
+ (concat) { dup 0 get exch 1 get _concat }
(empty?) { 0 get length 0 eq }
(count) { 0 get length }
>> def