Slice constructor
Slice(
- dynamic array,
- dynamic n, [
- dynamic position
Creates $slice operator expression
-
array- Any valid expression as long as it resolves to an array. -
position- Optional. Any valid expression as long as it resolves to an integer.- If positive,
$slicedetermines the starting position from the start of the array. Ifpositionis greater than the number of elements, the$slicereturns an empty array. *If negative,$slicedetermines the starting position from the end of the array. If the absolute value of thepositionis greater than the number of elements, the starting position is the start of the array.
- If positive,
-
n- Any valid expression as long as it resolves to an integer. Ifpositionis specified,nmust resolve to a positive integer.- If positive, $slice returns up to the first n elements in the array. If
the
positionis specified,$slicereturns the first n elements starting from the position. - If negative,
$slicereturns up to the lastnelements in the array.ncannot resolve to a negative number ifpositionis specified
- If positive, $slice returns up to the first n elements in the array. If
the
Implementation
Slice(array, n, [position])
: super('slice',
AEList([array is List ? AEList(array) : array, position, n]));