]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/persistent/hashtables/hashtables.factor
Delete empty unit tests files, remove 1- and 1+, reorder IN: lines in a lot of places...
[factor.git] / basis / persistent / hashtables / hashtables.factor
index a867dbb2e31859e059f01b1e92f5ebc6fa5684bb..0179216e62a7acc1f0a474e613695316dac56150 100644 (file)
@@ -1,7 +1,7 @@
 ! Based on Clojure's PersistentHashMap by Rich Hickey.
 
 USING: kernel math accessors assocs fry combinators parser
-prettyprint.backend make
+prettyprint.custom make
 persistent.assocs
 persistent.hashtables.nodes
 persistent.hashtables.nodes.empty
@@ -33,7 +33,7 @@ M: persistent-hash pluck-at
     {
         { [ 2dup root>> eq? ] [ nip ] }
         { [ over not ] [ 2drop T{ persistent-hash } ] }
-        [ count>> 1- persistent-hash boa ]
+        [ count>> 1 - persistent-hash boa ]
     } cond ;
 
 M: persistent-hash >alist [ root>> >alist% ] { } make ;
@@ -48,8 +48,11 @@ M: persistent-hash hashcode* nip assoc-size ;
 
 M: persistent-hash clone ;
 
-: PH{ \ } [ >persistent-hash ] parse-literal ; parsing
+SYNTAX: PH{ \ } [ >persistent-hash ] parse-literal ;
 
 M: persistent-hash pprint-delims drop \ PH{ \ } ;
 M: persistent-hash >pprint-sequence >alist ;
 M: persistent-hash pprint* pprint-object ;
+
+: passociate ( value key -- phash )
+    T{ persistent-hash } new-at ; inline