From 73d65aacb30cb05332ee7d2f733d81a000addc68 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Fri, 23 May 2014 14:24:04 -0700 Subject: [PATCH] core: update some help $value types. --- core/arrays/arrays-docs.factor | 2 +- core/byte-arrays/byte-arrays-docs.factor | 4 ++-- core/byte-vectors/byte-vectors-docs.factor | 4 ++-- core/checksums/checksums-docs.factor | 5 ++--- core/generic/math/math-docs.factor | 2 +- core/generic/single/single-docs.factor | 8 +++---- core/memory/memory-docs.factor | 2 +- core/quotations/quotations-docs.factor | 5 ++--- core/sequences/sequences-docs.factor | 10 ++++----- core/sorting/sorting-docs.factor | 12 +++++----- core/splitting/splitting-docs.factor | 26 +++++++++++----------- core/syntax/syntax-docs.factor | 4 ++-- core/vectors/vectors-docs.factor | 6 ++--- 13 files changed, 43 insertions(+), 47 deletions(-) diff --git a/core/arrays/arrays-docs.factor b/core/arrays/arrays-docs.factor index 5cdfcd3a80..d71649ef6c 100644 --- a/core/arrays/arrays-docs.factor +++ b/core/arrays/arrays-docs.factor @@ -50,7 +50,7 @@ HELP: { $description "Creates a new array with the given length and all elements initially set to " { $snippet "elt" } "." } ; HELP: >array -{ $values { "seq" "a sequence" } { "array" array } } +{ $values { "seq" sequence } { "array" array } } { $description "Outputs a freshly-allocated array with the same elements as a given sequence." } ; HELP: 1array diff --git a/core/byte-arrays/byte-arrays-docs.factor b/core/byte-arrays/byte-arrays-docs.factor index 1d8fa45b90..eeb0832af8 100644 --- a/core/byte-arrays/byte-arrays-docs.factor +++ b/core/byte-arrays/byte-arrays-docs.factor @@ -1,4 +1,4 @@ -USING: kernel help.markup help.syntax ; +USING: kernel help.markup help.syntax sequences ; IN: byte-arrays ARTICLE: "byte-arrays" "Byte arrays" @@ -39,7 +39,7 @@ HELP: (byte-array) { $description "Creates a new byte array with unspecified contents of length " { $snippet "n" } " bytes." } ; HELP: >byte-array -{ $values { "seq" "a sequence" } { "byte-array" byte-array } } +{ $values { "seq" sequence } { "byte-array" byte-array } } { $description "Outputs a freshly-allocated byte array whose elements have the same signed byte values as a given sequence." } { $errors "Throws an error if the sequence contains elements other than integers." } ; diff --git a/core/byte-vectors/byte-vectors-docs.factor b/core/byte-vectors/byte-vectors-docs.factor index f8ea6c732e..79c73c86ef 100644 --- a/core/byte-vectors/byte-vectors-docs.factor +++ b/core/byte-vectors/byte-vectors-docs.factor @@ -1,4 +1,4 @@ -USING: arrays byte-arrays help.markup help.syntax kernel combinators ; +USING: help.markup help.syntax sequences ; IN: byte-vectors ARTICLE: "byte-vectors" "Byte vectors" @@ -29,7 +29,7 @@ HELP: { $description "Creates a new byte vector that can hold " { $snippet "n" } " bytes before resizing." } ; HELP: >byte-vector -{ $values { "seq" "a sequence" } { "byte-vector" byte-vector } } +{ $values { "seq" sequence } { "byte-vector" byte-vector } } { $description "Outputs a freshly-allocated byte vector with the same elements as a given sequence." } { $errors "Throws an error if the sequence contains elements other than integers." } ; diff --git a/core/checksums/checksums-docs.factor b/core/checksums/checksums-docs.factor index 498e23f01f..b08bd9ec70 100644 --- a/core/checksums/checksums-docs.factor +++ b/core/checksums/checksums-docs.factor @@ -1,12 +1,11 @@ -USING: help.markup help.syntax kernel math sequences quotations -math.private byte-arrays strings ; +USING: byte-arrays help.markup help.syntax sequences strings ; IN: checksums HELP: checksum { $class-description "The class of checksum algorithms." } ; HELP: hex-string -{ $values { "seq" "a sequence" } { "str" "a string" } } +{ $values { "seq" sequence } { "str" string } } { $description "Converts a sequence of values from 0-255 to a string of hex numbers from 0-ff." } { $examples { $example "USING: checksums io ;" "B{ 1 2 3 4 } hex-string print" "01020304" } diff --git a/core/generic/math/math-docs.factor b/core/generic/math/math-docs.factor index e21e2114d9..ed2339d8de 100644 --- a/core/generic/math/math-docs.factor +++ b/core/generic/math/math-docs.factor @@ -19,7 +19,7 @@ HELP: math-upgrade { $examples { $example "USING: generic.math math kernel prettyprint ;" "fixnum bignum math-upgrade ." "[ [ >bignum ] dip ]" } } ; HELP: no-math-method -{ $values { "left" "an object" } { "right" "an object" } { "generic" generic } } +{ $values { "left" object } { "right" object } { "generic" generic } } { $description "Throws a " { $link no-math-method } " error." } { $error-description "Thrown by generic words using the " { $link math-combination } " method combination if there is no suitable method defined for the two inputs." } ; diff --git a/core/generic/single/single-docs.factor b/core/generic/single/single-docs.factor index 8f81be762c..382337dcbf 100644 --- a/core/generic/single/single-docs.factor +++ b/core/generic/single/single-docs.factor @@ -1,9 +1,9 @@ -USING: generic help.markup help.syntax sequences math -math.parser effects ; +USING: effects generic help.markup help.syntax kernel math +math.parser sequences ; IN: generic.single HELP: no-method -{ $values { "object" "an object" } { "generic" "a generic word" } } +{ $values { "object" object } { "generic" "a generic word" } } { $description "Throws a " { $link no-method } " error." } { $error-description "Thrown by the " { $snippet "generic" } " word to indicate it does not have a method for the class of " { $snippet "object" } "." } ; @@ -24,4 +24,4 @@ HELP: inconsistent-next-method $nl "This usually indicates programmer error; if the intention above was to call the string method on the result of " { $link number>string } ", the code should be rewritten as follows:" { $code "M: integer error-test number>string error-test ;" } -} ; \ No newline at end of file +} ; diff --git a/core/memory/memory-docs.factor b/core/memory/memory-docs.factor index 3d3e15f953..39e0e79fe3 100644 --- a/core/memory/memory-docs.factor +++ b/core/memory/memory-docs.factor @@ -10,7 +10,7 @@ HELP: gc { $description "Performs a full garbage collection." } ; HELP: size -{ $values { "obj" "an object" } { "n" "a size in bytes" } } +{ $values { "obj" object } { "n" "a size in bytes" } } { $description "Outputs the size of the object in memory, in bytes. Tagged immediate objects such as fixnums and " { $link f } " will yield a size of 0." } ; HELP: save-image diff --git a/core/quotations/quotations-docs.factor b/core/quotations/quotations-docs.factor index 10f0ac10dc..edd79846cd 100644 --- a/core/quotations/quotations-docs.factor +++ b/core/quotations/quotations-docs.factor @@ -1,5 +1,4 @@ -USING: arrays help.markup help.syntax strings sbufs -vectors kernel combinators ; +USING: help.markup help.syntax kernel sequences ; IN: quotations ARTICLE: "quotations" "Quotations" @@ -49,7 +48,7 @@ HELP: quotation { $description "The class of quotations. See " { $link "syntax-quots" } " for syntax and " { $link "quotations" } " for general information." } ; HELP: >quotation -{ $values { "seq" "a sequence" } { "quot" quotation } } +{ $values { "seq" sequence } { "quot" quotation } } { $description "Outputs a freshly-allocated quotation with the same elements as a given sequence." } ; HELP: 1quotation diff --git a/core/sequences/sequences-docs.factor b/core/sequences/sequences-docs.factor index d3d9ad047c..85ea78af83 100644 --- a/core/sequences/sequences-docs.factor +++ b/core/sequences/sequences-docs.factor @@ -268,18 +268,18 @@ HELP: first4 { $errors "Throws an error if the sequence has less than four elements." } ; HELP: array-capacity -{ $values { "array" "an array" } { "n" "a non-negative fixnum" } } +{ $values { "array" array } { "n" "a non-negative fixnum" } } { $class-description "A predicate class whose instances are valid array sizes for the current architecture. The minimum value is zero and the maximum value is " { $link max-array-capacity } "." } { $description "Low-level array length accessor." } { $warning "This word is in the " { $vocab-link "sequences.private" } " vocabulary because it is unsafe. It does not check types, so improper use can corrupt memory." } ; HELP: array-nth -{ $values { "n" "a non-negative fixnum" } { "array" "an array" } { "elt" object } } +{ $values { "n" "a non-negative fixnum" } { "array" array } { "elt" object } } { $description "Low-level array element accessor." } { $warning "This word is in the " { $vocab-link "sequences.private" } " vocabulary because it is unsafe. It does not check types or array bounds, and improper use can corrupt memory. User code must use " { $link nth } " instead." } ; HELP: set-array-nth -{ $values { "elt" object } { "n" "a non-negative fixnum" } { "array" "an array" } } +{ $values { "elt" object } { "n" "a non-negative fixnum" } { "array" array } } { $description "Low-level array element mutator." } { $warning "This word is in the " { $vocab-link "sequences.private" } " vocabulary because it is unsafe. It does not check types or array bounds, and improper use can corrupt memory. User code must use " { $link set-nth } " instead." } ; @@ -1041,7 +1041,7 @@ HELP: supremum { min max supremum infimum } related-words HELP: produce -{ $values { "pred" { $quotation ( ..a -- ..b ? ) } } { "quot" { $quotation ( ..b -- ..a obj ) } } { "seq" "a sequence" } } +{ $values { "pred" { $quotation ( ..a -- ..b ? ) } } { "quot" { $quotation ( ..b -- ..a obj ) } } { "seq" sequence } } { $description "Calls " { $snippet "pred" } " repeatedly. If the predicate yields " { $link f } ", stops, otherwise, calls " { $snippet "quot" } " to yield a value. Values are accumulated and returned in a sequence at the end." } { $examples "The following example divides a number by two until we reach zero, and accumulates intermediate results:" @@ -1051,7 +1051,7 @@ HELP: produce } ; HELP: produce-as -{ $values { "pred" { $quotation ( ..a -- ..b ? ) } } { "quot" { $quotation ( ..b -- ..a obj ) } } { "exemplar" sequence } { "seq" "a sequence" } } +{ $values { "pred" { $quotation ( ..a -- ..b ? ) } } { "quot" { $quotation ( ..b -- ..a obj ) } } { "exemplar" sequence } { "seq" sequence } } { $description "Calls " { $snippet "pred" } " repeatedly. If the predicate yields " { $link f } ", stops, otherwise, calls " { $snippet "quot" } " to yield a value. Values are accumulated and returned in a sequence of type " { $snippet "exemplar" } " at the end." } { $examples "See " { $link produce } " for examples." } ; diff --git a/core/sorting/sorting-docs.factor b/core/sorting/sorting-docs.factor index 69a2e33897..22d17b57d3 100644 --- a/core/sorting/sorting-docs.factor +++ b/core/sorting/sorting-docs.factor @@ -23,24 +23,24 @@ $nl ABOUT: "sequences-sorting" HELP: sort -{ $values { "seq" "a sequence" } { "quot" { $quotation ( obj1 obj2 -- <=> ) } } { "sortedseq" "a new sorted sequence" } } +{ $values { "seq" sequence } { "quot" { $quotation ( obj1 obj2 -- <=> ) } } { "sortedseq" "a new sorted sequence" } } { $description "Sorts the elements of " { $snippet "seq" } " into a new array using a stable sort." } { $notes "The algorithm used is the merge sort." } ; HELP: sort-with -{ $values { "seq" "a sequence" } { "quot" { $quotation ( elt -- key ) } } { "sortedseq" "a new sorted sequence" } } +{ $values { "seq" sequence } { "quot" { $quotation ( elt -- key ) } } { "sortedseq" "a new sorted sequence" } } { $description "Sorts the elements of " { $snippet "seq" } " by applying " { $link compare } " with " { $snippet "quot" } " to each pair of elements in the sequence." } ; HELP: inv-sort-with -{ $values { "seq" "a sequence" } { "quot" { $quotation ( elt -- key ) } } { "sortedseq" "a new sorted sequence" } } +{ $values { "seq" sequence } { "quot" { $quotation ( elt -- key ) } } { "sortedseq" "a new sorted sequence" } } { $description "Sorts the elements of " { $snippet "seq" } " by applying " { $link compare } " with " { $snippet "quot" } " to each pair of elements in the sequence and inverting the results." } ; HELP: sort-keys -{ $values { "obj" "an object" } { "sortedseq" "a new sorted sequence" } } +{ $values { "obj" object } { "sortedseq" "a new sorted sequence" } } { $description "Sorts the elements of " { $snippet "obj" } " (converting to an alist first if not a sequence), comparing first elements of pairs using the " { $link <=> } " word." } ; HELP: sort-values -{ $values { "obj" "an object" } { "sortedseq" "a new sorted sequence" } } +{ $values { "obj" object } { "sortedseq" "a new sorted sequence" } } { $description "Sorts the elements of " { $snippet "obj" } " (converting to an alist first if not a sequence), comparing second elements of pairs using the " { $link <=> } " word." } ; HELP: natural-sort @@ -52,7 +52,7 @@ HELP: sort-pair { $description "If " { $snippet "a" } " is greater than " { $snippet "b" } ", exchanges " { $snippet "a" } " with " { $snippet "b" } "." } ; HELP: midpoint@ -{ $values { "seq" "a sequence" } { "n" integer } } +{ $values { "seq" sequence } { "n" integer } } { $description "Outputs the index of the midpoint of " { $snippet "seq" } "." } ; { <=> compare natural-sort sort-with inv-sort-with sort-keys sort-values } related-words diff --git a/core/splitting/splitting-docs.factor b/core/splitting/splitting-docs.factor index 2a598883f9..d1a2c6fd80 100644 --- a/core/splitting/splitting-docs.factor +++ b/core/splitting/splitting-docs.factor @@ -26,59 +26,59 @@ ARTICLE: "sequences-split" "Splitting sequences" ABOUT: "sequences-split" HELP: split1 -{ $values { "seq" "a sequence" } { "subseq" "a sequence" } { "before" "a new sequence" } { "after" "a new sequence" } } +{ $values { "seq" sequence } { "subseq" sequence } { "before" "a new sequence" } { "after" "a new sequence" } } { $description "Splits " { $snippet "seq" } " at the first occurrence of " { $snippet "subseq" } ", and outputs the pieces before and after the split. If " { $snippet "subseq" } " does not occur in " { $snippet "seq" } ", then " { $snippet "before" } " is just " { $snippet "seq" } " and " { $snippet "after" } " is " { $link f } "." } ; HELP: split1-slice -{ $values { "seq" "a sequence" } { "subseq" "a sequence" } { "before-slice" slice } { "after-slice" slice } } +{ $values { "seq" sequence } { "subseq" sequence } { "before-slice" slice } { "after-slice" slice } } { $description "Splits " { $snippet "seq" } " at the first occurrence of " { $snippet "subseq" } ", and outputs the pieces before and after the split as slices. If " { $snippet "subseq" } " does not occur in " { $snippet "seq" } ", then " { $snippet "before" } " is just " { $snippet "seq" } " and " { $snippet "after" } " is " { $link f } "." } ; HELP: split1-when -{ $values { "seq" "a sequence" } { "quot" { $quotation ( ... elt -- ... ? ) } } { "before" "a new sequence" } { "after" "a new sequence" } } +{ $values { "seq" sequence } { "quot" { $quotation ( ... elt -- ... ? ) } } { "before" "a new sequence" } { "after" "a new sequence" } } { $description "Splits " { $snippet "seq" } " at the first occurrence of an element for which " { $snippet "quot" } " gives a true output and outputs the pieces before and after the split." } ; HELP: split1-when-slice -{ $values { "seq" "a sequence" } { "quot" { $quotation ( ... elt -- ... ? ) } } { "before-slice" slice } { "after-slice" slice } } +{ $values { "seq" sequence } { "quot" { $quotation ( ... elt -- ... ? ) } } { "before-slice" slice } { "after-slice" slice } } { $description "Splits " { $snippet "seq" } " at the first occurrence of an element for which " { $snippet "quot" } " gives a true output and outputs the pieces before and after the split as slices. If " { $snippet "subseq" } " does not occur in " { $snippet "seq" } ", then " { $snippet "before" } " is just " { $snippet "seq" } " and " { $snippet "after" } " is " { $link f } "." } ; HELP: split1-last -{ $values { "seq" "a sequence" } { "subseq" "a sequence" } { "before" "a new sequence" } { "after" "a new sequence" } } +{ $values { "seq" sequence } { "subseq" sequence } { "before" "a new sequence" } { "after" "a new sequence" } } { $description "Splits " { $snippet "seq" } " at the last occurrence of " { $snippet "subseq" } ", and outputs the pieces before and after the split. If " { $snippet "subseq" } " does not occur in " { $snippet "seq" } ", then " { $snippet "before" } " is just " { $snippet "seq" } " and " { $snippet "after" } " is " { $link f } "." } ; HELP: split1-last-slice -{ $values { "seq" "a sequence" } { "subseq" "a sequence" } { "before-slice" slice } { "after-slice" slice } } +{ $values { "seq" sequence } { "subseq" sequence } { "before-slice" slice } { "after-slice" slice } } { $description "Splits " { $snippet "seq" } " at the last occurrence of " { $snippet "subseq" } ", and outputs the pieces before and after the split as slices. If " { $snippet "subseq" } " does not occur in " { $snippet "seq" } ", then " { $snippet "before" } " is just " { $snippet "seq" } " and " { $snippet "after" } " is " { $link f } "." } ; { split1 split1-slice split1-last split1-last-slice } related-words HELP: split-when -{ $values { "seq" "a sequence" } { "quot" { $quotation ( ... elt -- ... ? ) } } { "pieces" "a new array" } } +{ $values { "seq" sequence } { "quot" { $quotation ( ... elt -- ... ? ) } } { "pieces" "a new array" } } { $description "Splits " { $snippet "seq" } " at each occurrence of an element for which " { $snippet "quot" } " gives a true output and outputs an array of pieces. The pieces do not include the elements along which the sequence was split." } { $examples { $example "USING: ascii kernel prettyprint splitting ;" "\"hello,world-how.are:you\" [ letter? not ] split-when ." "{ \"hello\" \"world\" \"how\" \"are\" \"you\" }" } } ; HELP: split-when-slice -{ $values { "seq" "a sequence" } { "quot" { $quotation ( ... elt -- ... ? ) } } { "pieces" "a new array" } } +{ $values { "seq" sequence } { "quot" { $quotation ( ... elt -- ... ? ) } } { "pieces" "a new array" } } { $description "Splits " { $snippet "seq" } " at each occurrence of an element for which " { $snippet "quot" } " gives a true output and outputs an array of pieces as slices. The pieces do not include the elements along which the sequence was split." } ; HELP: split -{ $values { "seq" "a sequence" } { "separators" "a sequence" } { "pieces" "a new array" } } +{ $values { "seq" sequence } { "separators" sequence } { "pieces" "a new array" } } { $description "Splits " { $snippet "seq" } " at each occurrence of an element of " { $snippet "separators" } " and outputs an array of pieces. The pieces do not include the elements along which the sequence was split." } { $examples { $example "USING: prettyprint splitting ;" "\"hello world-how are you?\" \" -\" split ." "{ \"hello\" \"world\" \"how\" \"are\" \"you?\" }" } } ; HELP: ?head -{ $values { "seq" "a sequence" } { "begin" "a sequence" } { "newseq" "a new sequence" } { "?" "a boolean" } } +{ $values { "seq" sequence } { "begin" sequence } { "newseq" "a new sequence" } { "?" "a boolean" } } { $description "Tests if " { $snippet "seq" } " starts with " { $snippet "begin" } ". If there is a match, outputs the subrange of " { $snippet "seq" } " excluding " { $snippet "begin" } ", and " { $link t } ". If there is no match, outputs " { $snippet "seq" } " and " { $link f } "." } ; HELP: ?head-slice -{ $values { "seq" "a sequence" } { "begin" "a sequence" } { "newseq" slice } { "?" "a boolean" } } +{ $values { "seq" sequence } { "begin" sequence } { "newseq" slice } { "?" "a boolean" } } { $description "Like " { $link ?head } ", except the resulting sequence is a " { $link slice } "." } ; HELP: ?tail -{ $values { "seq" "a sequence" } { "end" "a sequence" } { "newseq" "a new sequence" } { "?" "a boolean" } } +{ $values { "seq" sequence } { "end" sequence } { "newseq" "a new sequence" } { "?" "a boolean" } } { $description "Tests if " { $snippet "seq" } " ends with " { $snippet "end" } ". If there is a match, outputs the subrange of " { $snippet "seq" } " excluding " { $snippet "end" } ", and " { $link t } ". If there is no match, outputs " { $snippet "seq" } " and " { $link f } "." } ; HELP: ?tail-slice -{ $values { "seq" "a sequence" } { "end" "a sequence" } { "newseq" slice } { "?" "a boolean" } } +{ $values { "seq" sequence } { "end" sequence } { "newseq" slice } { "?" "a boolean" } } { $description "Like " { $link ?tail } ", except the resulting sequence is a " { $link slice } "." } ; HELP: string-lines diff --git a/core/syntax/syntax-docs.factor b/core/syntax/syntax-docs.factor index c7d974deb4..708d9da67b 100644 --- a/core/syntax/syntax-docs.factor +++ b/core/syntax/syntax-docs.factor @@ -361,7 +361,7 @@ HELP: B{ HELP: H{ { $syntax "H{ { key value }... }" } -{ $values { "key" "an object" } { "value" "an object" } } +{ $values { "key" object } { "value" object } } { $description "Marks the beginning of a literal hashtable, given as a list of two-element arrays holding key/value pairs. Literal hashtables are terminated by " { $link POSTPONE: } } "." } { $examples { $code "H{ { \"tuna\" \"fish\" } { \"jalapeno\" \"vegetable\" } }" } } ; @@ -406,7 +406,7 @@ $nl HELP: W{ { $syntax "W{ object }" } -{ $values { "object" "an object" } } +{ $values { "object" object } } { $description "Marks the beginning of a literal wrapper. Literal wrappers are terminated by " { $link POSTPONE: } } "." } ; HELP: POSTPONE: diff --git a/core/vectors/vectors-docs.factor b/core/vectors/vectors-docs.factor index 2d9b2df906..035d131dd2 100644 --- a/core/vectors/vectors-docs.factor +++ b/core/vectors/vectors-docs.factor @@ -1,6 +1,4 @@ -USING: arrays byte-arrays help.markup -help.syntax kernel sbufs strings quotations sequences.private -vectors.private combinators ; +USING: help.markup help.syntax kernel sequences ; IN: vectors ARTICLE: "vectors" "Vectors" @@ -37,7 +35,7 @@ HELP: { $description "Creates a new vector that can hold " { $snippet "n" } " elements before resizing." } ; HELP: >vector -{ $values { "seq" "a sequence" } { "vector" vector } } +{ $values { "seq" sequence } { "vector" vector } } { $description "Outputs a freshly-allocated vector with the same elements as a given sequence." } ; HELP: 1vector -- 2.34.1