slice-error ( from to seq -- * )


Vocabulary
sequences

Inputs
None

Outputs
None

Word description
Throws a slice-error.

Error description
Thrown by <slice> if one of the following invalid conditions holds:
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


Definition


Methods

M: slice-error summary
"Cannot create slice" swap {
{ [ dup from>> 0 < ] [ ": from < 0" ] }
{
[ dup [ to>> ] [ seq>> length ] bi > ]
[ ": to > length" ]
}
{ [ dup [ from>> ] [ to>> ] bi > ] [ ": from > to" ] }
[ f ]
} cond nip append ;