ExCellerate.Functions.General.Slice (excellerate v0.4.0)

Copy Markdown View Source

Extracts a contiguous section of a list given a start index and optional length.

The start index is zero-based. Negative indices count from the end of the list. When length is omitted, returns everything from the start index to the end.

Examples

slice(items, 1)        elements from index 1 to end
slice(items, 1, 3)     3 elements starting at index 1
slice(items, -2)       last 2 elements
slice(items, -3, 2)    2 elements starting 3 from end