factor/library/collections/virtual-sequences.facts

30 lines
1.5 KiB
Plaintext
Raw Normal View History

2006-01-02 00:51:03 -05:00
USING: help sequences ;
2006-08-01 17:35:00 -04:00
HELP: slice-error "( str -- )"
{ $values { "str" "a reason" } }
{ $description "Throws a " { $link slice-error } "." }
{ $error-description "Thrown by " { $link <slice> } " 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 f
{ $class-description "A virtual sequence which presents a subrange of the elements of an underlying sequence." }
{ $see-also <slice> subseq } ;
2006-01-02 00:51:03 -05:00
HELP: <slice> "( m n seq -- slice )"
{ $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." } ;
2006-05-14 23:25:34 -04:00
HELP: reverse "( seq -- reversed )"
{ $values { "seq" "a sequence" } { "reversed" "a sequence" } }
2006-06-04 03:46:06 -04:00
{ $description "Outputs a new sequence having the same elements as " { $snippet "seq" } " but in reverse order." } ;
2006-05-14 23:25:34 -04:00
HELP: <reversed> "( seq -- reversed )"
{ $values { "seq" "a sequence" } { "reversed" "a sequence" } }
{ $description "Outputs a virtual sequence sharing storage with " { $snippet "seq" } " but with reverse element order." } ;