math.statistics: in some words, interchanging the positions of the $examples and a $description

db4
Keita Haga 2011-01-18 23:19:21 +09:00
parent 8b1fbbf3b7
commit cb06cba857
1 changed files with 10 additions and 10 deletions

View File

@ -75,27 +75,27 @@ HELP: histogram
{ "seq" sequence } { "seq" sequence }
{ "hashtable" hashtable } { "hashtable" hashtable }
} }
{ $description "Returns a hashtable where the keys are the elements of the sequence and the values are the number of times they appeared in that sequence." }
{ $examples { $examples
{ $example "! Count the number of times an element appears in a sequence." { $example "! Count the number of times an element appears in a sequence."
"USING: prettyprint math.statistics ;" "USING: prettyprint math.statistics ;"
"\"aaabc\" histogram ." "\"aaabc\" histogram ."
"H{ { 97 3 } { 98 1 } { 99 1 } }" "H{ { 97 3 } { 98 1 } { 99 1 } }"
} }
} } ;
{ $description "Returns a hashtable where the keys are the elements of the sequence and the values are the number of times they appeared in that sequence." } ;
HELP: histogram! HELP: histogram!
{ $values { $values
{ "hashtable" hashtable } { "seq" sequence } { "hashtable" hashtable } { "seq" sequence }
} }
{ $description "Takes an existing hashtable and uses " { $link histogram } " to continue counting the number of occurrences of each element." }
{ $examples { $examples
{ $example "! Count the number of times the elements of two sequences appear." { $example "! Count the number of times the elements of two sequences appear."
"USING: prettyprint math.statistics ;" "USING: prettyprint math.statistics ;"
"\"aaabc\" histogram \"aaaaaabc\" histogram! ." "\"aaabc\" histogram \"aaaaaabc\" histogram! ."
"H{ { 97 9 } { 98 2 } { 99 2 } }" "H{ { 97 9 } { 98 2 } { 99 2 } }"
} }
} } ;
{ $description "Takes an existing hashtable and uses " { $link histogram } " to continue counting the number of occurrences of each element." } ;
HELP: sorted-histogram HELP: sorted-histogram
{ $values { $values
@ -115,41 +115,41 @@ HELP: sequence>assoc
{ "seq" sequence } { "quot" quotation } { "exemplar" "an exemplar assoc" } { "seq" sequence } { "quot" quotation } { "exemplar" "an exemplar assoc" }
{ "assoc" assoc } { "assoc" assoc }
} }
{ $description "Iterates over a sequence, allowing elements of the sequence to be added to a newly created " { $snippet "assoc" } " according to the passed quotation." }
{ $examples { $examples
{ $example "! Iterate over a sequence and increment the count at each element" { $example "! Iterate over a sequence and increment the count at each element"
"USING: assocs prettyprint math.statistics ;" "USING: assocs prettyprint math.statistics ;"
"\"aaabc\" [ inc-at ] H{ } sequence>assoc ." "\"aaabc\" [ inc-at ] H{ } sequence>assoc ."
"H{ { 97 3 } { 98 1 } { 99 1 } }" "H{ { 97 3 } { 98 1 } { 99 1 } }"
} }
} } ;
{ $description "Iterates over a sequence, allowing elements of the sequence to be added to a newly created " { $snippet "assoc" } " according to the passed quotation." } ;
HELP: sequence>assoc! HELP: sequence>assoc!
{ $values { $values
{ "assoc" assoc } { "seq" sequence } { "quot" quotation } { "assoc" assoc } { "seq" sequence } { "quot" quotation }
} }
{ $description "Iterates over a sequence, allowing elements of the sequence to be added to an existing " { $snippet "assoc" } " according to the passed quotation." }
{ $examples { $examples
{ $example "! Iterate over a sequence and add the counts to an existing assoc" { $example "! Iterate over a sequence and add the counts to an existing assoc"
"USING: assocs prettyprint math.statistics kernel ;" "USING: assocs prettyprint math.statistics kernel ;"
"H{ { 97 2 } { 98 1 } } clone \"aaabc\" [ inc-at ] sequence>assoc! ." "H{ { 97 2 } { 98 1 } } clone \"aaabc\" [ inc-at ] sequence>assoc! ."
"H{ { 97 5 } { 98 2 } { 99 1 } }" "H{ { 97 5 } { 98 2 } { 99 1 } }"
} }
} } ;
{ $description "Iterates over a sequence, allowing elements of the sequence to be added to an existing " { $snippet "assoc" } " according to the passed quotation." } ;
HELP: sequence>hashtable HELP: sequence>hashtable
{ $values { $values
{ "seq" sequence } { "quot" quotation } { "seq" sequence } { "quot" quotation }
{ "hashtable" hashtable } { "hashtable" hashtable }
} }
{ $description "Iterates over a sequence, allowing elements of the sequence to be added to a hashtable according to the passed quotation." }
{ $examples { $examples
{ $example "! Count the number of times an element occurs in a sequence" { $example "! Count the number of times an element occurs in a sequence"
"USING: assocs prettyprint math.statistics ;" "USING: assocs prettyprint math.statistics ;"
"\"aaabc\" [ inc-at ] sequence>hashtable ." "\"aaabc\" [ inc-at ] sequence>hashtable ."
"H{ { 97 3 } { 98 1 } { 99 1 } }" "H{ { 97 3 } { 98 1 } { 99 1 } }"
} }
} } ;
{ $description "Iterates over a sequence, allowing elements of the sequence to be added to a hashtable according to the passed quotation." } ;
ARTICLE: "histogram" "Computing histograms" ARTICLE: "histogram" "Computing histograms"
"Counting elements in a sequence:" "Counting elements in a sequence:"