]> gitweb.factorcode.org Git - factor.git/commitdiff
prettyprint.stylesheet: use assoc-union! and set-at when possible.
authorJohn Benediktsson <mrjbq7@gmail.com>
Fri, 10 Jul 2015 19:37:31 +0000 (12:37 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Fri, 10 Jul 2015 19:37:31 +0000 (12:37 -0700)
basis/prettyprint/stylesheet/stylesheet.factor

index 4056a27e9ac4966cfa985a2b3a42b4d65704c01b..f19c34db2aaf89f1ce6779b40f97a854c415e3ff 100644 (file)
@@ -23,16 +23,19 @@ GENERIC: word-style ( word -- style )
 
 M: word word-style
     [ presented associate ]
-    [ "word-style" word-prop >hashtable ] bi assoc-union ;
+    [ "word-style" word-prop ] bi assoc-union! ;
 
 M: highlighted-word word-style
-    call-next-method COLOR: DarkSlateGray foreground associate
-    swap assoc-union ;
+    call-next-method
+    COLOR: DarkSlateGray foreground pick set-at ;
 
 <PRIVATE
 
 : colored-presentation-style ( obj color -- style )
-    [ presented associate ] [ foreground associate ] bi* assoc-union ;
+    H{ } clone [
+        [ presented foreground ] dip
+        [ set-at ] curry bi-curry@ bi*
+    ] keep ;
 
 PRIVATE>