core: update some help $value types.

db4
John Benediktsson 2014-05-23 14:24:04 -07:00
parent dff051696e
commit 73d65aacb3
13 changed files with 43 additions and 47 deletions

View File

@ -50,7 +50,7 @@ HELP: <array>
{ $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

View File

@ -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." } ;

View File

@ -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: <byte-vector>
{ $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." } ;

View File

@ -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" }

View File

@ -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." } ;

View File

@ -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 ;" }
} ;
} ;

View File

@ -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

View File

@ -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

View File

@ -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." } ;

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -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: <vector>
{ $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