One Dimensional Array

The OneDimensionalArray is used for storing data in a one-dimensional indexed data structure. Such an array is a homogeneous data structure in that all the entries of the array must belong to the same Axiom domain. Each array has a fixed length specified by the user and arrays are not extensible. The indexing of one-dimensional arrays is one-based. This means that the "first" element of an array is given the index 1. See also Vector and FlexibleArray. To create a one-dimensional array, apply the operation oneDimensionalArray to a list.

Another approach is to first create a, a one-dimensional array of 10 0's. OneDimensionalArray has a convenient abbreviation ARRAY1.

Set each ith element to i, then display the result.

Square each element by mapping the function i+->i**2 onto each element.

Reverse the elements in place.

Swap the 4th and 5th element.

Sort the elements in place.

Create a new one-dimensional array b containing the last 5 elements of a.

Replace the first 5 elements of a with those of b.