Numerical arrays with native storage
Run checked vector arithmetic, dot products, cumulative sums, and population statistics, then copy Float64 values into a Tensor.
Download .aner source// Native typed loops; every input and result keeps an explicit dtype.
let x = Array<Float64>(size: 3, fill: 0.0)
x.set(0, 1.0)
x.set(1, 2.0)
x.set(2, 3.0)
let y = x.scale(factor: 2.0)
print(y.to_list())
print(x.sum())
print(x.mean())
print(x.dot(y))
print(x.cumsum().to_list())
print(x.variance())
print(x.std())
print(x.add(y).to_list())
let matrix = x.to_tensor(rows: 1, cols: 3)
print(type_of(matrix))
let integers = DynamicArray<Int64>(capacity: 3)
integers.append(1)
integers.append(2)
integers.append(3)
print(integers.to_float().scale(0.5).to_list())
Make it your experiment.
With Aner installed, save this program as examples/arrays_numeric.aner inside a folder for your experiment. Open a terminal in that folder, then check and run the program.
aner check examples/arrays_numeric.aner
aner run examples/arrays_numeric.anerThe aner command must be on your PATH. Follow the installation guide if your terminal cannot find it.
Use the compatible native Aner interpreter and VS Code extension 0.1.26 or newer. Arrays are built in and require no import. Every array requires an explicit Int64, Float64, Bool, or String element type; see the typed array guide for method contracts and complexity.
Iris and Wine are teaching datasets with their own attribution. Example outcomes are not comparative benchmarks or evidence of clinical validity.
Dataset sources & attribution