All: add keywords.
[jackhill/mal.git] / ps / types.ps
index 82be9c2..1f6903e 100644 (file)
@@ -173,11 +173,34 @@ end } def
 
 % Symbols
 
+/_symbol {
+    dup length string copy cvn
+} def
+
 /_symbol? {
     type /nametype eq
 } def
 
 
+% Keywords
+
+/_keyword { 1 dict begin
+    /str exch def
+    str length 1 add string % str2
+    dup 1 str putinterval
+    dup 0 127 put % TODO: something like (\x029e) would be better
+end } def
+
+/_keyword? {
+    dup type /stringtype eq {
+        0 get 127 eq
+    }{
+        false
+    } ifelse
+} def
+
+
+
 % Functions
 
 % block -> _function -> boxed_function