hints: fix two examples and formatting in docs

db4
Keita Haga 2010-11-30 04:53:11 +09:00
parent e7796b4118
commit 3e7af33343
1 changed files with 20 additions and 14 deletions

View File

@ -24,20 +24,26 @@ HELP: HINTS:
{ $description "Defines specialization hints for a word or a method." { $description "Defines specialization hints for a word or a method."
$nl $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? } "." } "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:" { $examples
{ $code "HINTS: append { string string } { array array } ;" } "The " { $link append } " word has a specializer for the very common case where two strings or two arrays are appended:"
"Specializers can also be defined on methods:" { $code
{ $code "USING: arrays hints sequences strings syntax ;"
"GENERIC: count-occurrences ( elt obj -- n )" "HINTS: append { string string } { array array } ;"
"" }
"M: sequence count-occurrences [ = ] with count ;" "Specializers can also be defined on methods:"
"" { $code
"M: assoc count-occurrences" "USING: assocs hashtables hints kernel sequences"
" swap [ = nip ] curry assoc-filter assoc-size ;" "syntax ;"
"" "GENERIC: count-occurrences ( elt obj -- n )"
"HINTS: M\ sequence count-occurrences { object array } ;" ""
"HINTS: M\ assoc count-occurrences { object hashtable } ;" "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" ABOUT: "hints"