All: add keywords.
[jackhill/mal.git] / perl / types.pm
index 356f8c6..e2d919c 100644 (file)
@@ -5,10 +5,9 @@ no if $] >= 5.018, warnings => "experimental::smartmatch";
 use feature qw(switch);
 use Exporter 'import';
 our @EXPORT_OK = qw(_sequential_Q _equal_Q _clone
-                    $nil $true $false
-                    _symbol_Q _nil_Q _true_Q _false_Q _list_Q _vector_Q
-                    _hash_map _hash_map_Q _assoc_BANG _dissoc_BANG
-                    _atom_Q);
+                    $nil $true $false _nil_Q _true_Q _false_Q
+                    _symbol _symbol_Q _keyword _keyword_Q _list_Q _vector_Q
+                    _hash_map _hash_map_Q _assoc_BANG _dissoc_BANG _atom_Q);
 
 use Data::Dumper;
 
@@ -111,10 +110,13 @@ sub _false_Q { return $_[0] eq $false }
     package Symbol;
     sub new  { my $class = shift; bless \$_[0] => $class }
 }
-
 sub _symbol_Q { (ref $_[0]) =~ /^Symbol/ }
 
 
+sub _keyword { return String->new(("\x{029e}".$_[0])); }
+sub _keyword_Q { ((ref $_[0]) =~ /^String/) && ${$_[0]} =~ /^\x{029e}/; }
+
+
 {
     package String;
     sub new  { my $class = shift; bless \$_[0] => $class }