Slice
Represents a range specification for indexing operations with start, stop, and step parameters.
Slice objects define ranges for accessing elements in containers, similar to Python slices. They specify a start index, stop index, and step size, allowing for flexible data access patterns including reverse iteration and skipping elements. Slices can be used with arrays, strings, and other indexable containers to extract subsequences or perform bulk operations.
Constructors
Slice() -> Slice
Constructs an empty Slice.
Slice(const Slice rhs) -> Slice
Slice copy constructor.
Parameters
- rhs: The slice to copy from.
Slice(integer start, integer stop) -> Slice
Constructs a Slice with the specified start, stop values.
Parameters
- start: The start index.
- stop: The stop index.
Slice(integer start, integer stop, integer step) -> Slice
Constructs a Slice with the specified start, stop and step values.
Parameters
- start: The start index.
- stop: The stop index.
- step: The step size (default is 1).
Symbols
| Name | Description |
|---|---|
= | Assignment operator for Slice objects. |
Members
| Name | Description |
|---|---|
| resolve | Resolves the slice parameters for a given container size. |
| start | Returns the start index of the slice. |
| step | Returns the step size of the slice. |
| stop | Returns the stop index of the slice. |