List is a basic linear data structure.
Variations: Nonempty List, Scrolling List, Sliding List
Supertype (List item) ~ Maybe (Nonempty List item)
You can transforma a List into a Sum of Unit and Nonempty List with objective:
Available methods (Stackable):
pop: Transition `T'I` List item `T'I` Optional item
push: item `AR_` Transition `T'I` List item `T'I` item
How to construct an empty list:
Empty @List Unit
empty @List
How to construct a list of elements:
List @Integer `ha` Item 1 `ha` Next `ha` Item 3 `ha` Last `hv` Unit
The easiest way to define it is to use ya-literal package:
items = [1, 2, 3, 4, 5, 6, 7, 8, 9]
You can traverse a List but you have to specify in which order you want to do it:
items `yokl` Forth `ha` World `ha` output ===> 123456789
items `yokl` Prior `ha` World `ha` output ===> 987654321