Hash :
ef195ae9
Author :
Thomas de Grivel
Date :
2024-10-14T17:14:30
Linked lists owning the data (each node contains a couple of tags : one for data and one for next pointer.
Regular lists can be :
[1, 2, 3]
[1 | [2, 3]]
[1, 2 | [3]]
[]
Regular lists end with the empty list : [1] == [1 | []]
.
You can also contruct dotted lists like in Common Lisp where the next list pointer is an arbitrary form. E.g. :
[1 | 2]
[1, 2, 3 | 4]
[[] | 1]
All these list formats are supported in pattern matching.
List List.map (List, Fn)
List List.reverse (List)
Top : KC3 documentation
Previous : 1.4 Ratio
Next : 1.6 Variable
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 33 34 35 36 37 38
# 1.5 List
Linked lists owning the data (each node contains a couple of tags :
one for data and one for next pointer.
Regular lists can be :
- multiple elements : `[1, 2, 3]`
- an element and a list : `[1 | [2, 3]]`
- multiple elements and a list : `[1, 2 | [3]]`
- the empty list : `[]`
Regular lists end with the empty list : `[1] == [1 | []]`.
You can also contruct dotted lists like in Common Lisp where
the next list pointer is an arbitrary form. E.g. :
- an element and an element : `[1 | 2]`
- multiple elements and an element : `[1, 2, 3 | 4]`
- the empty list and an element : `[[] | 1]`
All these list formats are supported in pattern matching.
## 1.5.1 Functions
```elixir
List List.map (List, Fn)
```
```elixir
List List.reverse (List)
```
---
Top : [KC3 documentation](/doc/)
Previous : [1.4 Ratio](1.4_Ratio)
Next : [1.6 Variable](1.6_Variable)