prettyprint.stylesheet: use assoc-union! and set-at when possible.

db4
John Benediktsson 2015-07-10 12:37:31 -07:00
parent 752ceb57fc
commit df50480878
1 changed files with 7 additions and 4 deletions

View 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>