Arrays
Ordered values, one-based indexes, and immutable updates.
Make an ordered list
Square brackets create an array. An array remembers order, and its first position is 1.
The result is 9. Negative indexes count from the end, so scores[-1] is the final value.
One-based indexing is deliberate: positions in RiX line up with the way a mathematician labels terms in a sequence. A missing position and a value that happens to be zero are different facts. Methods such as HasAt let code make that distinction when an array contains holes.
Bracket slicing is inclusive at both ends. The tuple above therefore contains the first value, the last value, and a two-value middle slice. Run each expression separately if the combined output feels too dense.
Return an updated array
Array methods without an exclamation point return a changed copy. This makes intermediate calculations easy to inspect.
The original scores is still [4, 9, 16]. This non-mutating style is a strong default because every name remains an inspectable step in the calculation. Bang methods such as Push! deliberately update their receiver; reserve them for code where shared changing state is actually part of the model.
Transform the elements
Arrays participate in RiX's collection pipes. Mapping changes every element, while filtering keeps only elements that satisfy a predicate.
This is an optional preview of Pipes: |>> maps each value and |>? filters by a condition. The callback (value) -> ... describes one item's transformation. It can also receive a one-based position and the source collection when needed. Use the function chips below for method signatures and further examples.