aboutsummaryrefslogtreecommitdiffstats
path: root/docs/reference/05-1_arrays.md
blob: 19075f5f52338ec85fccd0756191a80af5ba799c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Arrays are composite types that contain a fixed number of values of the same
type. Arrays values can be created using square brackets `[1 2 3]` (which is
syntactic sugar for the [`(mkarray …)`][:mkarray:] builtin).

This uses [Pure Op](04-2_pure-operators.html) semantics to construct an array
from several values, all of which have to be of the same type.

    (trace [1 2 3])
```output
<num[3]= [1 2 3]>
```

The type notation `num[3]` designates an array of three numbers, whereas the
value notation `[1 2 3]` is used to show the array contents.

The [array][:array/:] module provides *Op*s for working with arrays.