]> gitweb.factorcode.org Git - factor.git/commitdiff
hints: fix two examples and formatting in docs
authorKeita Haga <keitahaga@mail.com>
Mon, 29 Nov 2010 19:53:11 +0000 (04:53 +0900)
committerKeita Haga <keitahaga@mail.com>
Mon, 29 Nov 2010 19:53:11 +0000 (04:53 +0900)
basis/hints/hints-docs.factor

index 46bdc698b73a59874c1884ba25626bfec96aa5fa..4ff973a25118ed1b75a5d0d41a6a810a405e905f 100644 (file)
@@ -24,20 +24,26 @@ HELP: HINTS:
 { $description "Defines specialization hints for a word or a method."
 $nl
 "Each sequence in the list will cause a specialized version of the word to be compiled. Classes are tested for using their predicate, and literals are tested using " { $link eq? } "." }
-{ $examples "The " { $link append } " word has a specializer for the very common case where two strings or two arrays are appended:"
-{ $code "HINTS: append { string string } { array array } ;" }
-"Specializers can also be defined on methods:"
-{ $code
-    "GENERIC: count-occurrences ( elt obj -- n )"
-    ""
-    "M: sequence count-occurrences [ = ] with count ;"
-    ""
-    "M: assoc count-occurrences"
-    "    swap [ = nip ] curry assoc-filter assoc-size ;"
-    ""
-    "HINTS: M\ sequence count-occurrences { object array } ;"
-    "HINTS: M\ assoc count-occurrences { object hashtable } ;"
-}
+{ $examples
+    "The " { $link append } " word has a specializer for the very common case where two strings or two arrays are appended:"
+    { $code
+        "USING: arrays hints sequences strings syntax ;"
+        "HINTS: append { string string } { array array } ;"
+    }
+    "Specializers can also be defined on methods:"
+    { $code
+        "USING: assocs hashtables hints kernel sequences"
+        "syntax ;"
+        "GENERIC: count-occurrences ( elt obj -- n )"
+        ""
+        "M: sequence count-occurrences [ = ] with count ;"
+        ""
+        "M: assoc count-occurrences"
+        "    swap [ = nip ] curry assoc-filter assoc-size ;"
+        ""
+        "HINTS: M\\ sequence count-occurrences { object array } ;"
+        "HINTS: M\\ assoc count-occurrences { object hashtable } ;"
+    }
 } ;
 
 ABOUT: "hints"