slice
extract a slice from a list
(list xs, long start, long end) -> list
Returns a sublist of xs
starting at index start
inclusively, and extending to index end
exclusively. If end
is nil
, the sublist extends to the end of xs
.
Returns an empty list if start
is greater than the last index in xs
. Returns an empty list if start >= end
.
Returns nil
if xs
is nil
, or start
is nil
.
Throws an error if start < 0
.
Parameters
Name | Type | Description |
---|---|---|
xs |
list | The list to work with |
start |
long | Extracted sublist starts at this index |
end |
long |
Extracted sublist extends to - but does not include - this index. If set to |