This page documents library functions related to lists.
Tail
Get the tail of a list (all elements excluding the first).
Arguments
| Argument | Description | Domain | Constraints | Notes |
|---|---|---|---|---|
| source list | Not empty. |
Return
| Value | Description | Codomain | Constraints | Notes |
|---|---|---|---|---|
| tail | if is empty. |
Instances
f_{tail}\left(\left[\right]\right)
=\frac{1}{0}
f_{tail}\left(\left[0\right]\right)-\left[\right]
f_{tail}\left(\left[0,\ 10\right]\right)-\left[10\right]
f_{tail}\left(\left[0,\ 10,\ 100\right]\right)-\left[10,\ 100\right] Implementation
Dependencies
None
Count Occurrences
Count the number of occurrences of a value in a list .
Arguments
| Argument | Description | Domain | Constraints | Notes |
|---|---|---|---|---|
| source list | The list can be empty. | |||
| target value |
Return
| Value | Description | Codomain | Constraints | Notes |
|---|---|---|---|---|
| occurrence count | for an empty list. |
Instances
f_{count}\left(\left[\right],\ 1\right) - 0
f_{count}\left(\left[1\right],\ 1\right) - 1
f_{count}\left(\left[1,\ 1,\ 1\right],\ 1\right) - 3 Implementation
Dependencies
None
Count Occurrences (parallelised)
For each value in , count the number of times appears in .
Arguments
| Argument | Description | Domain | Constraints | Notes |
|---|---|---|---|---|
| source list | The list can be empty. | |||
| target values | The list can be empty. |
Return
| Value | Description | Codomain | Constraints | Notes |
|---|---|---|---|---|
| occurrence counts | Same lenth as | Counts are in the same order as their corresponding values in . |
Instances
f_{countl}\left(\left[\right],\ \left[\right]\right)-\left[\right]
f_{countl}\left(\left[0,\ 1\right],\ \left[\right]\right)-\left[\right]
f_{countl}\left(\left[\right],\ \left[1\right]\right)-0
f_{countl}\left(\left[0,\ 1,\ 1,\ 1\right],\ \left[1\right]\right)-3
f_{countl}\left(\left[0,\ 1,\ 1,\ 1,\ 10,\ 10\right],\ \left[1,\ 10\right]\right)-\left[3,\ 2\right] Implementation
Dependencies
None
Map Occurrences
Map each unique value in to a point, where is the number of times appears in .
Arguments
| Argument | Description | Domain | Constraints | Notes |
|---|---|---|---|---|
| source list | List can be empty. |
Return
| Value | Description | Codomain | Constraints | Notes |
|---|---|---|---|---|
| occurrence counts | Same length as . | Points are in the same order as the corresponding values in . |
Instances
f_{counts}\left(\left[\right]\right)-\left[\right]
f_{counts}\left(\left[0,\ 10,\ 10\right]\right)-\left[\left(0,\ 1\right),\ \left(10,\ 2\right)\right]
f_{counts}\left(\left[0,\ 10,\ 0,\ 100,\ 10\right]\right)-\left[\left(0,\ 2\right),\ \left(10,\ 2\right),\ \left(100,\ 1\right)\right] Implementation
Dependencies
None