HomeManualTopicsTypesSymbols

std_types::list/std::range

returns the specified subrange of the specified list

Parameters

self
the list
first
the index of the first item to include in the range
last
the index of the last item to include in the range

Results

None

Description

The first item has the index 1, the second item the index 2 and so on.

Negative indices start at the end of the list.

The last item has the index -1, the next to last item the index -s and so on.

Both indices are inclusive. So a range starting at index 4 and ending at index 5 contains two items.

A range can be empty. An example for an empty range would be start index 8 and end index 7.

It is an error for any index to lie outside the list's index range. It is also an error if the resulting range would contain a negative number of items.

If the range spans the whole list then the list is returned unchanged.

Otherwise a new list (with fresh attributes) is created and returned.

Implements

std::range returns a subrange of a collection