]> gitweb.factorcode.org Git - factor.git/commitdiff
help: move predicate default word help.
authorJohn Benediktsson <mrjbq7@gmail.com>
Fri, 27 May 2016 00:35:37 +0000 (17:35 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Fri, 27 May 2016 00:35:37 +0000 (17:35 -0700)
basis/help/help.factor

index 00605cb03590fa8eebcffc26b8811b2e538f855b..a77aec0a94a3c9d76fa2ed88d824795040942510 100644 (file)
@@ -23,6 +23,15 @@ M: word default-word-help
         ] { } map>assoc
     ] bi@ append members \ $values prefix 1array ;
 
+M: predicate default-word-help
+    { $values { "object" object } { "?" boolean } }
+    [
+        \ $description ,
+        "Tests if the object is an instance of the " ,
+        swap "predicating" word-prop <$link> ,
+        " class." ,
+    ] { } make 2array ;
+
 M: class default-word-help drop f ;
 
 PRIVATE>
@@ -30,25 +39,7 @@ PRIVATE>
 GENERIC: word-help* ( word -- content )
 
 : word-help ( word -- content )
-    dup "help" word-prop [ ] [
-        dup word-help* [
-            swap 2array 1array
-        ] [
-            default-word-help
-        ] if*
-    ] ?if ;
-
-: $predicate ( element -- )
-    { { "object" object } { "?" boolean } } $values
-    [
-        "Tests if the object is an instance of the " ,
-        first "predicating" word-prop <$link> ,
-        " class." ,
-    ] { } make $description ;
-
-M: word word-help* drop f ;
-
-M: predicate word-help* drop \ $predicate ;
+    dup "help" word-prop [ ] [ default-word-help ] ?if ;
 
 : all-articles ( -- seq )
     articles get keys