Futhark arrays are written as values enclosed in square brackets.
The type of
i32 to be pedantic). The element type of an array can be another array:
The type of
i32. Arrays must be regular, meaning that all elements must have the same shape. An array such as
[[1,2],  is illegal.
Arrays can be indexed from zero:
We can even slice or index only some dimensions:
[, ]. Slices are inclusive in the starting position and exclusive in the ending position as Dijkstra wills it.
Strides are also supported. Generally, The expression
a[i:j:s] returns a slice of the array
a from index
i (inclusive) to
j (exclusive) with a stride of
s. If the stride is positive, then
i <= j must hold, and if the stride is negative, then
j <= i must hold. For example, we can reverse an array like this:
Some syntactic sugar is provided for concisely specifying arrays of intervals of integers. The expression
x...y produces an array of the integers from
y, both inclusive. The upper bound can be made exclusive by writing
x..<y. For example:
It is usually necessary to enclose a range expression in parentheses, because they bind very loosely. A stride can be provided by writing
x..y...z, with the interpretation “first
y, up to
z”. For example:
[1, 3, 5, 7].
Reference manual: slicing.