USING: help sequences ; HELP: reversed { $class-description "A virtual sequence which presents a reversed view of an underlying sequence." } { $see-also reverse } ; HELP: reversed@ { $values { "m" "a non-negative integer" } { "reversed" "an instance of " { $link reversed } } { "n" "a non-negative integer" } { "seq" "a sequence" } } { $description "Indexes into a reversed sequence. Helper word used to implement " { $link "sequence-protocol" } " methods for the " { $link reversed } " class." } ; HELP: reverse { $values { "seq" "a sequence" } { "newseq" "a new sequence" } } { $description "Outputs a new sequence having the same elements as " { $snippet "seq" } " but in reverse order." } ; HELP: ( seq -- reversed ) { $values { "seq" "a sequence" } { "reversed" "a new sequence" } } { $description "Creates an instance of the " { $link reversed } " virtual sequence." } ; HELP: slice-error { $values { "str" "a reason" } } { $description "Throws a " { $link slice-error } "." } { $error-description "Thrown by " { $link } " if one of the following invalid conditions holds:" { $list "The start index is negative" "The end index is greater than the length of the sequence" "The start index is greater than the end index" } } ; HELP: slice { $class-description "A virtual sequence which presents a subrange of the elements of an underlying sequence." } { $see-also subseq } ; HELP: { $values { "m" "a non-negative integer" } { "n" "a non-negative integer" } { "seq" "a sequence" } { "slice" "a slice" } } { $description "Outputs a new virtual sequence sharing storage with the subrange of elements in " { $snippet "seq" } " with indices starting from and including " { $snippet "m" } ", and up to but not including " { $snippet "n" } "." } { $errors "Throws an error if " { $snippet "m" } " or " { $snippet "n" } " is out of bounds." } ; HELP: slice@ { $values { "m" "a non-negative integer" } { "slice" "an instance of " { $link slice } } { "n" "a non-negative integer" } { "seq" "a sequence" } } { $description "Indexes into a slice. Helper word used to implement " { $link "sequence-protocol" } " methods for the " { $link reversed } " class." } ; HELP: column { $class-description "A virtual sequence which presents a fixed column of a matrix represented as a sequence of rows." } { $see-also } ; HELP: { $values { "seq" "a sequence" } { "n" "a non-negative integer" } } { $description "Outputs a new virtual sequence which presents a fixed column of a matrix represented as a sequence of rows." "The " { $snippet "i" } "th element of a column is the " { $snippet "n" } "th element of the " { $snippet "i" } "th element of" { $snippet "seq" } ". Every element of " { $snippet "seq" } " must be a sequence, and all sequences must have equal length." } { $examples { $example "{ { 1 2 3 } { 4 5 6 } { 7 8 9 } } 0 >array ." "{ 1 4 7 }" } } { $notes "In the same sense that " { $link } " is a virtual variant of " { $link reverse } ", " { $link } " is a virtual variant of " { $snippet "[ swap nth ] map-with" } "." } ; HELP: column@ { $values { "m" "a non-negative integer" } { "column" "an instance of " { $link column } } { "n" "a non-negative integer" } { "seq" "a sequence" } } { $description "Indexes into a column view of a matrix. Helper word used to implement " { $link "sequence-protocol" } " methods for the " { $link column } " class." } ;