]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/vocabs/prettyprint/prettyprint.factor
use reject instead of [ ... not ] filter.
[factor.git] / basis / vocabs / prettyprint / prettyprint.factor
index 3c5059b5c0563b9382d133eae5aa5dfba3ed4088..07fecef4a2d96e352ba731d6324b9de7fa2254a5 100644 (file)
@@ -8,7 +8,7 @@ FROM: io.styles => inset ;
 IN: vocabs.prettyprint
 
 : pprint-vocab ( vocab -- )
-    [ vocab-name ] [ vocab vocab-style ] bi styled-text ;
+    [ vocab-name ] [ lookup-vocab vocab-style ] bi styled-text ;
 
 : pprint-in ( vocab -- )
     [ \ IN: pprint-word pprint-vocab ] with-pprint ;
@@ -19,7 +19,7 @@ IN: vocabs.prettyprint
     [ vocab-name ] sort-with ;
 
 : pprint-using ( seq -- )
-    [ "syntax" vocab = not ] filter
+    [ "syntax" lookup-vocab = ] reject
     sort-vocabs [
         \ USING: pprint-word
         [ pprint-vocab ] each
@@ -64,12 +64,15 @@ M: rename pprint-qualified ( rename -- )
         tri
     ] with-pprint ;
 
+: filter-interesting ( seq -- seq' )
+    [ [ vocab? ] [ extra-words? ] bi or ] reject ;
+
 PRIVATE>
 
 : (pprint-manifest ( manifest -- quots )
     [
         [ search-vocabs>> [ '[ _ pprint-using ] , ] unless-empty ]
-        [ qualified-vocabs>> [ extra-words? not ] filter [ '[ _ pprint-qualified ] , ] each ]
+        [ qualified-vocabs>> filter-interesting [ '[ _ pprint-qualified ] , ] each ]
         [ current-vocab>> [ '[ _ pprint-in ] , ] when* ]
         tri
     ] { } make ;
@@ -87,9 +90,10 @@ PRIVATE>
         "To avoid doing this in the future, add the following forms" print
         "at the top of the source file:" print nl
     ] with-style
-    { { page-color COLOR: FactorLightLightTan }
-      { border-color COLOR: FactorDarkTan }
-      { inset { 5 5 } } }
-    [ manifest get pprint-manifest ] with-nesting
+    {
+        { page-color COLOR: FactorLightTan }
+        { border-color COLOR: FactorDarkTan }
+        { inset { 5 5 } }
+    } [ manifest get pprint-manifest ] with-nesting
     nl nl
-] print-use-hook set-global
\ No newline at end of file
+] print-use-hook set-global