From 84e5c21fa908e60e0b2e298804e9fc6782e961cc Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Tue, 18 Jan 2011 18:35:48 +0900 Subject: [PATCH 01/14] help.tutorial: minor fix --- basis/help/tutorial/tutorial.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/help/tutorial/tutorial.factor b/basis/help/tutorial/tutorial.factor index ce9c4b4676..b3e306ac56 100644 --- a/basis/help/tutorial/tutorial.factor +++ b/basis/help/tutorial/tutorial.factor @@ -102,7 +102,7 @@ $nl "For example, we'd like it to identify the following as a palindrome:" { $code "\"A man, a plan, a canal: Panama.\"" } "However, right now, the simplistic algorithm we use says this is not a palindrome:" -{ $unchecked-example "\"A man, a plan, a canal: Panama.\" palindrome?" "f" } +{ $unchecked-example "\"A man, a plan, a canal: Panama.\" palindrome? ." "f" } "We would like it to output " { $link t } " there. We can encode this requirement with a unit test that we add to " { $snippet "palindrome-tests.factor" } ":" { $code "[ t ] [ \"A man, a plan, a canal: Panama.\" palindrome? ] unit-test" } "If you now run unit tests, you will see a unit test failure:" From e8ce62c64e64d50ad0b76786eeb023c57cf72d02 Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Tue, 18 Jan 2011 21:18:35 +0900 Subject: [PATCH 02/14] math.intervals: fix some typos in docs --- basis/math/intervals/intervals-docs.factor | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/basis/math/intervals/intervals-docs.factor b/basis/math/intervals/intervals-docs.factor index 7e0a9a3b51..fd6a72807f 100644 --- a/basis/math/intervals/intervals-docs.factor +++ b/basis/math/intervals/intervals-docs.factor @@ -184,23 +184,23 @@ HELP: interval-max HELP: interval-mod { $values { "i1" interval } { "i2" interval } { "i3" interval } } -{ $description "Outputs an interval containing all possible values obtained by aplying " { $link mod } " to elements of " { $snippet "i1" } " and " { $snippet "i2" } "." } ; +{ $description "Outputs an interval containing all possible values obtained by applying " { $link mod } " to elements of " { $snippet "i1" } " and " { $snippet "i2" } "." } ; HELP: interval-rem { $values { "i1" interval } { "i2" interval } { "i3" interval } } -{ $description "Outputs an interval containing all possible values obtained by aplying " { $link rem } " to elements of " { $snippet "i1" } " and " { $snippet "i2" } "." } ; +{ $description "Outputs an interval containing all possible values obtained by applying " { $link rem } " to elements of " { $snippet "i1" } " and " { $snippet "i2" } "." } ; HELP: interval-bitand { $values { "i1" interval } { "i2" interval } { "i3" interval } } -{ $description "Outputs an interval containing all possible values obtained by aplying " { $link bitand } " to elements of " { $snippet "i1" } " and " { $snippet "i2" } "." } ; +{ $description "Outputs an interval containing all possible values obtained by applying " { $link bitand } " to elements of " { $snippet "i1" } " and " { $snippet "i2" } "." } ; HELP: interval-bitor { $values { "i1" interval } { "i2" interval } { "i3" interval } } -{ $description "Outputs an interval containing all possible values obtained by aplying " { $link bitor } " to elements of " { $snippet "i1" } " and " { $snippet "i2" } "." } ; +{ $description "Outputs an interval containing all possible values obtained by applying " { $link bitor } " to elements of " { $snippet "i1" } " and " { $snippet "i2" } "." } ; HELP: interval-bitxor { $values { "i1" interval } { "i2" interval } { "i3" interval } } -{ $description "Outputs an interval containing all possible values obtained by aplying " { $link bitxor } " to elements of " { $snippet "i1" } " and " { $snippet "i2" } "." } ; +{ $description "Outputs an interval containing all possible values obtained by applying " { $link bitxor } " to elements of " { $snippet "i1" } " and " { $snippet "i2" } "." } ; HELP: interval-min { $values { "i1" interval } { "i2" interval } { "i3" interval } } From 8b1fbbf3b7bfc3019beb8f1cab0f3413eca293d2 Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Tue, 18 Jan 2011 22:30:53 +0900 Subject: [PATCH 03/14] math.statistics: fix a few typos in docs --- basis/math/statistics/statistics-docs.factor | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/basis/math/statistics/statistics-docs.factor b/basis/math/statistics/statistics-docs.factor index f7d108dddb..85c1f4a0cc 100644 --- a/basis/math/statistics/statistics-docs.factor +++ b/basis/math/statistics/statistics-docs.factor @@ -34,7 +34,7 @@ HELP: range { $description "Computes the difference of the maximum and minimum values in " { $snippet "seq" } "." } { $examples { $example "USING: math.statistics prettyprint ;" "{ 1 2 3 } range ." "2" } - { $example "USING: math.statistics prettyprint ;" "{ 1 2 3 4 } range ." "3" } } ; + { $example "USING: math.statistics prettyprint ;" "{ 1 2 3 4 } range ." "3" } } ; HELP: minmax { $values { "seq" sequence } { "min" real } { "max" real } } @@ -75,7 +75,7 @@ HELP: histogram { "seq" sequence } { "hashtable" hashtable } } -{ $examples +{ $examples { $example "! Count the number of times an element appears in a sequence." "USING: prettyprint math.statistics ;" "\"aaabc\" histogram ." @@ -88,21 +88,21 @@ HELP: histogram! { $values { "hashtable" hashtable } { "seq" sequence } } -{ $examples +{ $examples { $example "! Count the number of times the elements of two sequences appear." "USING: prettyprint math.statistics ;" "\"aaabc\" histogram \"aaaaaabc\" histogram! ." "H{ { 97 9 } { 98 2 } { 99 2 } }" } } -{ $description "Takes an existing hashtable and uses " { $link histogram } " to continue counting the number of occurences of each element." } ; +{ $description "Takes an existing hashtable and uses " { $link histogram } " to continue counting the number of occurrences of each element." } ; HELP: sorted-histogram { $values { "seq" sequence } { "alist" "an array of key/value pairs" } } -{ $description "Outputs a " { $link histogram } " of a sequence sorted by number of occurences from lowest to highest." } +{ $description "Outputs a " { $link histogram } " of a sequence sorted by number of occurrences from lowest to highest." } { $examples { $example "USING: prettyprint math.statistics ;" """"abababbbbbbc" sorted-histogram .""" @@ -115,7 +115,7 @@ HELP: sequence>assoc { "seq" sequence } { "quot" quotation } { "exemplar" "an exemplar assoc" } { "assoc" assoc } } -{ $examples +{ $examples { $example "! Iterate over a sequence and increment the count at each element" "USING: assocs prettyprint math.statistics ;" "\"aaabc\" [ inc-at ] H{ } sequence>assoc ." @@ -128,7 +128,7 @@ HELP: sequence>assoc! { $values { "assoc" assoc } { "seq" sequence } { "quot" quotation } } -{ $examples +{ $examples { $example "! Iterate over a sequence and add the counts to an existing assoc" "USING: assocs prettyprint math.statistics kernel ;" "H{ { 97 2 } { 98 1 } } clone \"aaabc\" [ inc-at ] sequence>assoc! ." @@ -142,7 +142,7 @@ HELP: sequence>hashtable { "seq" sequence } { "quot" quotation } { "hashtable" hashtable } } -{ $examples +{ $examples { $example "! Count the number of times an element occurs in a sequence" "USING: assocs prettyprint math.statistics ;" "\"aaabc\" [ inc-at ] sequence>hashtable ." From cb06cba85795c77dcf961ac04b5a99d4f9c55f65 Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Tue, 18 Jan 2011 23:19:21 +0900 Subject: [PATCH 04/14] math.statistics: in some words, interchanging the positions of the $examples and a $description --- basis/math/statistics/statistics-docs.factor | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/basis/math/statistics/statistics-docs.factor b/basis/math/statistics/statistics-docs.factor index 85c1f4a0cc..63263e603c 100644 --- a/basis/math/statistics/statistics-docs.factor +++ b/basis/math/statistics/statistics-docs.factor @@ -75,27 +75,27 @@ HELP: histogram { "seq" sequence } { "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 { $example "! Count the number of times an element appears in a sequence." "USING: prettyprint math.statistics ;" "\"aaabc\" histogram ." "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! { $values { "hashtable" hashtable } { "seq" sequence } } +{ $description "Takes an existing hashtable and uses " { $link histogram } " to continue counting the number of occurrences of each element." } { $examples { $example "! Count the number of times the elements of two sequences appear." "USING: prettyprint math.statistics ;" "\"aaabc\" histogram \"aaaaaabc\" histogram! ." "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 { $values @@ -115,41 +115,41 @@ HELP: sequence>assoc { "seq" sequence } { "quot" quotation } { "exemplar" "an exemplar 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 { $example "! Iterate over a sequence and increment the count at each element" "USING: assocs prettyprint math.statistics ;" "\"aaabc\" [ inc-at ] H{ } sequence>assoc ." "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! { $values { "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 { $example "! Iterate over a sequence and add the counts to an existing assoc" "USING: assocs prettyprint math.statistics kernel ;" "H{ { 97 2 } { 98 1 } } clone \"aaabc\" [ inc-at ] sequence>assoc! ." "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 { $values { "seq" sequence } { "quot" quotation } { "hashtable" hashtable } } +{ $description "Iterates over a sequence, allowing elements of the sequence to be added to a hashtable according to the passed quotation." } { $examples { $example "! Count the number of times an element occurs in a sequence" "USING: assocs prettyprint math.statistics ;" "\"aaabc\" [ inc-at ] sequence>hashtable ." "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" "Counting elements in a sequence:" From 5043611252bd8ef80b8abad4fb49604ba254eb39 Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Tue, 18 Jan 2011 23:35:52 +0900 Subject: [PATCH 05/14] math.polynomials: fix typo in description of pextend-conv word --- basis/math/polynomials/polynomials-docs.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/math/polynomials/polynomials-docs.factor b/basis/math/polynomials/polynomials-docs.factor index dd55c3dd3f..ce00fcb495 100644 --- a/basis/math/polynomials/polynomials-docs.factor +++ b/basis/math/polynomials/polynomials-docs.factor @@ -62,7 +62,7 @@ HELP: n*p HELP: pextend-conv { $values { "p" "a polynomial" } { "q" "a polynomial" } { "p'" "a polynomial" } { "q'" "a polynomial" } } -{ $description "Convulution, extending to " { $snippet "p_m + q_n - 1" } "." } +{ $description "Convolution, extending to " { $snippet "p_m + q_n - 1" } "." } { $examples { $example "USING: kernel math.polynomials prettyprint ;" "{ 1 0 1 } { 0 1 } pextend-conv [ . ] bi@" "{ 1 0 1 0 }\n{ 0 1 0 0 }" } } ; HELP: p* From 904d85860a87489ac7118a8d0904b07a08b57a0c Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Thu, 20 Jan 2011 23:39:30 +0900 Subject: [PATCH 06/14] peg.ebnf: fix minor typo in docs --- basis/peg/ebnf/ebnf-docs.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/peg/ebnf/ebnf-docs.factor b/basis/peg/ebnf/ebnf-docs.factor index 2ffc7e0b29..7b740a4dc3 100644 --- a/basis/peg/ebnf/ebnf-docs.factor +++ b/basis/peg/ebnf/ebnf-docs.factor @@ -274,7 +274,7 @@ ARTICLE: "peg.ebnf.variable" "Variable" ; ARTICLE: "peg.ebnf.foreign-rules" "Foreign Rules" -"Rules can call outto other peg.ebnf defined parsers. The result of " +"Rules can call out to other peg.ebnf defined parsers. The result of " "the foreign call then becomes the AST of the successful parse. Foreign rules " "are invoked using '' or ''. The " "latter allows calling a specific rule in a previously designed peg.ebnf parser. " From 08bf39c5d145cd6fbbc573abed7c7e0d62803537 Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Fri, 21 Jan 2011 16:13:38 +0900 Subject: [PATCH 07/14] disjoint-sets: fix typo in description of assoc>disjoint-set word --- basis/disjoint-sets/disjoint-sets-docs.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/disjoint-sets/disjoint-sets-docs.factor b/basis/disjoint-sets/disjoint-sets-docs.factor index 73de932a30..589f99f6dc 100644 --- a/basis/disjoint-sets/disjoint-sets-docs.factor +++ b/basis/disjoint-sets/disjoint-sets-docs.factor @@ -23,7 +23,7 @@ HELP: equate HELP: assoc>disjoint-set { $values { "assoc" assoc } { "disjoint-set" disjoint-set } } -{ $description "Given an assoc representation of a graph where the keys are vertices and key/value pairs are edges, creates a disjoint set whose elements are the keys of assoc, and two keys are equvalent if they belong to the same connected component of the graph." } +{ $description "Given an assoc representation of a graph where the keys are vertices and key/value pairs are edges, creates a disjoint set whose elements are the keys of assoc, and two keys are equivalent if they belong to the same connected component of the graph." } { $examples { $example "USING: disjoint-sets kernel prettyprint ;" From 2a6e6517a0d0fdd2cdf9ffe0ced87306a8789483 Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Sun, 23 Jan 2011 21:51:52 +0900 Subject: [PATCH 08/14] effects: add missing right parenthesis in description of stack-effect word --- core/effects/effects-docs.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/effects/effects-docs.factor b/core/effects/effects-docs.factor index 44d216f872..7cd21a004e 100644 --- a/core/effects/effects-docs.factor +++ b/core/effects/effects-docs.factor @@ -143,4 +143,4 @@ HELP: effect>string HELP: stack-effect { $values { "word" word } { "effect/f" { $maybe effect } } } -{ $description "Outputs the stack effect of a word; either a stack effect declared with " { $link POSTPONE: ( } ", or an inferred stack effect (see " { $link "inference" } "." } ; +{ $description "Outputs the stack effect of a word; either a stack effect declared with " { $link POSTPONE: ( } ", or an inferred stack effect (see " { $link "inference" } ")." } ; From c04fbe892d9fae33db4c0d118c91fb340881cf76 Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Sun, 23 Jan 2011 21:56:19 +0900 Subject: [PATCH 09/14] stack-checker: add a sample output in the last example of inference-recursive-combinators article --- basis/stack-checker/stack-checker-docs.factor | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/basis/stack-checker/stack-checker-docs.factor b/basis/stack-checker/stack-checker-docs.factor index 4fa66f7f38..6b3bdd354f 100644 --- a/basis/stack-checker/stack-checker-docs.factor +++ b/basis/stack-checker/stack-checker-docs.factor @@ -91,9 +91,10 @@ $nl "However a small change can be made:" { $example ": good ( ? quot: ( ? -- ) -- ) [ good ] 2keep [ not ] dip call ; inline recursive" "[ [ drop ] good ] infer." "( x -- )" } "An inline recursive word must have a fixed stack effect in its base case. The following will not infer:" -{ $code +{ $example ": foo ( quot ? -- ) [ f foo ] [ call ] if ; inline" "[ [ 5 ] t foo ] infer." + "The inline recursive word “foo” must be declared recursive\nword foo" } ; ARTICLE: "tools.inference" "Stack effect tools" From 629ea1163ba86d2dbdd6ef86a3261017472b4385 Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Mon, 24 Jan 2011 04:00:17 +0900 Subject: [PATCH 10/14] memoize: correct documentation for MEMO: syntax --- basis/memoize/memoize-docs.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/memoize/memoize-docs.factor b/basis/memoize/memoize-docs.factor index 58ba60af7c..2fc7f6c260 100644 --- a/basis/memoize/memoize-docs.factor +++ b/basis/memoize/memoize-docs.factor @@ -22,7 +22,7 @@ HELP: define-memoized { $description "Defines the given word at run time as one which memoizes its outputs given a particular input." } ; HELP: MEMO: -{ $syntax "MEMO: word ( stack -- effect ) definition ;" } +{ $syntax "MEMO: word ( stack -- effect ) definition... ;" } { $description "Defines the given word at parse time as one which memoizes its output given a particular input. The stack effect is mandatory." } ; { define-memoized POSTPONE: MEMO: } related-words From 334d0de92ad1db218800b5e2e380a252d656c765 Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Wed, 26 Jan 2011 15:06:35 +0900 Subject: [PATCH 11/14] sequences: surround a $example with a $examples to the if-empty word's help --- core/sequences/sequences-docs.factor | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/sequences/sequences-docs.factor b/core/sequences/sequences-docs.factor index ea3e4cf4d3..22e1eede41 100644 --- a/core/sequences/sequences-docs.factor +++ b/core/sequences/sequences-docs.factor @@ -83,10 +83,12 @@ HELP: empty? HELP: if-empty { $values { "seq" sequence } { "quot1" quotation } { "quot2" quotation } } { $description "Makes an implicit check if the sequence is empty. An empty sequence is dropped and " { $snippet "quot1" } " is called. Otherwise, if the sequence has any elements, " { $snippet "quot2" } " is called on it." } -{ $example - "USING: kernel prettyprint sequences ;" - "{ 1 2 3 } [ \"empty sequence\" ] [ sum ] if-empty ." - "6" +{ $examples + { $example + "USING: kernel prettyprint sequences ;" + "{ 1 2 3 } [ \"empty sequence\" ] [ sum ] if-empty ." + "6" + } } ; HELP: when-empty From 187710a7b7abb9558135c8b82d19eabd747d7ee7 Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Wed, 26 Jan 2011 18:53:12 +0900 Subject: [PATCH 12/14] memoize: add description of arguments and values to MEMO: syntax in docs --- basis/memoize/memoize-docs.factor | 1 + 1 file changed, 1 insertion(+) diff --git a/basis/memoize/memoize-docs.factor b/basis/memoize/memoize-docs.factor index 2fc7f6c260..426bd2916c 100644 --- a/basis/memoize/memoize-docs.factor +++ b/basis/memoize/memoize-docs.factor @@ -23,6 +23,7 @@ HELP: define-memoized HELP: MEMO: { $syntax "MEMO: word ( stack -- effect ) definition... ;" } +{ $values { "word" "a new word to define" } { "definition" "a word definition" } } { $description "Defines the given word at parse time as one which memoizes its output given a particular input. The stack effect is mandatory." } ; { define-memoized POSTPONE: MEMO: } related-words From a2ad751f83e2fe26b313682266f84397632f077f Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Wed, 26 Jan 2011 21:26:12 +0900 Subject: [PATCH 13/14] classes.tuple: minor fix to $errors section in the boa word's help page --- core/classes/tuple/tuple-docs.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/classes/tuple/tuple-docs.factor b/core/classes/tuple/tuple-docs.factor index 7443e02cc5..6de3ed2957 100644 --- a/core/classes/tuple/tuple-docs.factor +++ b/core/classes/tuple/tuple-docs.factor @@ -444,7 +444,7 @@ HELP: boa { $values { "slots..." "slot values" } { "class" tuple-class } { "tuple" tuple } } { $description "Creates a new instance of " { $snippet "class" } " and fill in the slots from the stack, with the top-most stack element being stored in the right-most slot." } { $notes "The name " { $snippet "boa" } " is shorthand for “by order of arguments”, and “BOA constructor” is a pun on “boa constrictor”." } -{ $errors "Throws an error if the slot values do not match class declarations on slots (see" { $link "tuple-declarations" } ")." } ; +{ $errors "Throws an error if the slot values do not match class declarations on slots (see " { $link "tuple-declarations" } ")." } ; HELP: bad-superclass { $error-description "Thrown if an attempt is made to subclass a class that is not a tuple class, or a tuple class declared " { $link POSTPONE: final } "." } ; From 48ec189c994ade00ff01fb7402d40f5d631d8c7e Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Fri, 28 Jan 2011 11:48:07 +0900 Subject: [PATCH 14/14] xml.data: insert a space after a comma in description of contained class --- basis/xml/data/data-docs.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/xml/data/data-docs.factor b/basis/xml/data/data-docs.factor index feb035d37a..97aa362c17 100644 --- a/basis/xml/data/data-docs.factor +++ b/basis/xml/data/data-docs.factor @@ -139,7 +139,7 @@ HELP: closer { $class-description "Describes a closing tag, like " { $snippet "" } ". Contains one slot, " { $snippet "name" } ", containing the closer's name." } ; HELP: contained -{ $class-description "Represents a self-closing tag, like " { $snippet "" } ". Contains two slots," { $snippet "name" } " and " { $snippet "attrs" } " containing, respectively, the name of the tag and its attributes." } ; +{ $class-description "Represents a self-closing tag, like " { $snippet "" } ". Contains two slots, " { $snippet "name" } " and " { $snippet "attrs" } " containing, respectively, the name of the tag and its attributes." } ; { opener closer contained } related-words