30 lines
499 B
Markdown
30 lines
499 B
Markdown
# Arrays
|
|
|
|
Arrays are a standard Ava type. An array is a contiguous block of memory that
|
|
represents some grouping of a type.
|
|
|
|
```
|
|
let x: Array[Int32] := { 1, 2, 3 }
|
|
let zero: Array[Int32] := {}
|
|
let size: Int32 := size(x)
|
|
let arr: Array[Int32] := fill(512, 0)
|
|
```
|
|
|
|
## Type Class Support
|
|
|
|
- `Monad`
|
|
- `Show`
|
|
- `Eq`
|
|
|
|
## NonEmptyList
|
|
|
|
The type `NonEmptyList` is a list which cannot be empty:
|
|
|
|
```
|
|
given A
|
|
record NonEmptyList: (head: A, tail: List[A])
|
|
```
|
|
|
|
## Indexing
|
|
|
|
Lists cannot be accessed by index.
|