/usr/share/axiom-20170501/src/algebra/ARRAY1.spad is in axiom-source 20170501-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | )abbrev domain ARRAY1 OneDimensionalArray
++ Author: Mark Botch
++ Description:
++ This is the domain of 1-based one dimensional arrays
OneDimensionalArray(S) : SIG == CODE where
S : Type
ARRAYMININDEX ==> 1 -- if you want to change this, be my guest
SIG ==> OneDimensionalArrayAggregate S with
oneDimensionalArray : List S -> %
++ oneDimensionalArray(l) creates an array from a list of elements l
++
++X oneDimensionalArray [i**2 for i in 1..10]
oneDimensionalArray : (NonNegativeInteger, S) -> %
++ oneDimensionalArray(n,s) creates an array from n copies of element s
++
++X oneDimensionalArray(10,0.0)
CODE ==> IndexedOneDimensionalArray(S, ARRAYMININDEX) add
oneDimensionalArray(u) ==
n := #u
n = 0 => empty()
a := new(n, first u)
for i in 2..n for x in rest u repeat a.i := x
a
oneDimensionalArray(n,s) == new(n,s)
|