]> gitweb.factorcode.org Git - factor.git/commitdiff
sequences: fix docs
authorDoug Coleman <doug.coleman@gmail.com>
Tue, 21 Feb 2023 05:29:04 +0000 (23:29 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Sun, 26 Feb 2023 23:11:04 +0000 (17:11 -0600)
core/kernel/kernel-docs.factor
core/sequences/sequences-docs.factor
extra/sequences/extras/extras-docs.factor

index aba338a960025c68f52318e008c5e0a681fbbb95..7fe2e3d81b007cf409b00dcdf5cf875890a6a893 100644 (file)
@@ -717,7 +717,7 @@ HELP: unless*
 { $code "X [ Y ] unless*" "X dup [ ] [ drop Y ] if" } } ;
 
 HELP: ?if-old
-{ $values { "default" object } { "cond" "a generalized boolean" } { "true" { $quotation ( ..a cond -- ..b ) } } { "false" { $quotation ( ..a default -- ..b ) } } }
+{ $values { "obj" object } { "cond" "a generalized boolean" } { "true" { $quotation ( ..a cond -- ..b ) } } { "false" { $quotation ( ..a default -- ..b ) } } }
 { $description "If the condition is " { $link f } ", the " { $snippet "false" } " quotation is called with the " { $snippet "default" } " value on the stack. Otherwise, the " { $snippet "true" } " quotation is called with the condition on the stack." }
 { $notes
 "The following two lines are equivalent:"
index de5950322b40fc1f4a3c73297451fb8d09965eda..1ae56566fd588861b3ea4e342b01dac4de108d92 100644 (file)
@@ -31,11 +31,6 @@ HELP: nth
 { $contract "Outputs the " { $snippet "n" } "th element of the sequence. Elements are numbered from zero, so the last element has an index one less than the length of the sequence. All sequences support this operation." }
 { $errors "Throws a " { $link bounds-error } " if the index is negative, or greater than or equal to the length of the sequence." } ;
 
-HELP: nth-of
-{ $values { "seq" sequence } { "n" "a non-negative integer" } { "elt" "the element at the " { $snippet "n" } "th index" } }
-{ $contract "Outputs the " { $snippet "n" } "th element of the sequence. Elements are numbered from zero, so the last element has an index one less than the length of the sequence. All sequences support this operation." }
-{ $errors "Throws a " { $link bounds-error } " if the index is negative, or greater than or equal to the length of the sequence." } ;
-
 HELP: set-nth
 { $values { "elt" object } { "n" "a non-negative integer" } { "seq" "a mutable sequence" } }
 { $contract "Sets the " { $snippet "n" } "th element of the sequence. Storing beyond the end of a resizable sequence such as a vector or string buffer grows the sequence." }
@@ -189,15 +184,7 @@ HELP: ??nth
 { $values { "n" integer } { "seq" sequence } { "elt/f" { $maybe object } } { "?" boolean } }
 { $description "A forgiving version of " { $link nth } ". If the index is out of bounds, or if the sequence is " { $link f } ", simply outputs " { $link f } ". Also outputs a boolean to distinguish between the sequence containing an " { $link f } " or an out of bounds index." } ;
 
-HELP: ?nth-of
-{ $values { "seq" sequence } { "n" integer } { "elt/f" { $maybe object } } }
-{ $description "A forgiving version of " { $link nth-of } ". If the index is out of bounds, or if the sequence is " { $link f } ", simply outputs " { $link f } "." } ;
-
-HELP: ??nth-of
-{ $values { "seq" sequence } { "n" integer } { "elt/f" { $maybe object } } { "?" boolean } }
-{ $description "A forgiving version of " { $link nth-of } ". If the index is out of bounds, or if the sequence is " { $link f } ", simply outputs " { $link f } ". Also outputs a boolean to distinguish between the sequence containing an " { $link f } " or an out of bounds index." } ;
-
-{ nth ?nth ??nth nth-of ?nth-of ??nth-of } related-words
+{ nth ?nth ??nth } related-words
 
 HELP: ?set-nth
 { $values { "elt" object } { "n" integer } { "seq" sequence } }
@@ -1848,7 +1835,7 @@ ARTICLE: "sequence-protocol" "Sequence protocol"
 "All sequences must know their length:"
 { $subsections length }
 "At least one of the following two generic words must have a method for accessing elements; the " { $link sequence } " mixin has default definitions which are mutually recursive:"
-{ $subsections nth nth-unsafe ?nth ??nth nth-of ?nth-of ??nth-of }
+{ $subsections nth nth-unsafe ?nth }
 "Note that sequences are always indexed starting from zero."
 $nl
 "At least one of the following two generic words must have a method for storing elements; the " { $link sequence } " mixin has default definitions which are mutually recursive:"
@@ -1898,7 +1885,7 @@ $nl
 
 ARTICLE: "sequences-access" "Accessing sequence elements"
 "Element access by index, without raising exceptions:"
-{ $subsections ?nth ??nth ?nth-of ??nth-of }
+{ $subsections ?nth }
 "Concise way of extracting one of the first four elements:"
 { $subsections first second third fourth ?first ?second }
 "Extracting the last element:"
index 2a71908fbcfe6e712c8a9790204f462bcc25a750..f1a2d822c41988e4a10303ecc8a9797bd7dbdd1a 100644 (file)
@@ -1048,6 +1048,11 @@ HELP: merge-slices
     { "slice/*" object }
 } ;
 
+HELP: nth-of
+{ $values { "seq" sequence } { "n" "a non-negative integer" } { "elt" "the element at the " { $snippet "n" } "th index" } }
+{ $contract "Outputs the " { $snippet "n" } "th element of the sequence. Elements are numbered from zero, so the last element has an index one less than the length of the sequence. All sequences support this operation." }
+{ $errors "Throws a " { $link bounds-error } " if the index is negative, or greater than or equal to the length of the sequence." } ;
+
 HELP: nth*
 { $values
     { "n" integer } { "seq" sequence }