Nil[A: A]¶
The empty list of As.
Implements¶
- ReadSeq[val->A] box
Constructors¶
create¶
Returns¶
- Nil[A] val^
Public Functions¶
size¶
Returns the size of the list.
Returns¶
- USize val
apply¶
Returns the i-th element of the sequence. For the empty list this call will always error because any index will be out of bounds.
Parameters¶
- i: USize val
Returns¶
- val->A ?
values¶
Returns an empty iterator over the elements of the empty list.
Returns¶
- Iterator[val->A] ref^
is_empty¶
Returns a Bool indicating if the list is empty.
Returns¶
- Bool val
is_non_empty¶
Returns a Bool indicating if the list is non-empty.
Returns¶
- Bool val
head¶
Returns an error, since Nil has no head.
Returns¶
- val->A ?
tail¶
Returns an error, since Nil has no tail.
Returns¶
reverse¶
The reverse of the empty list is the empty list.
Returns¶
- Nil[A] val
prepend¶
Builds a new list with an element added to the front of this list.
Parameters¶
- a: val->A!
Returns¶
- Cons[A] val
concat¶
The concatenation of any list l with the empty list is l.
Parameters¶
Returns¶
map[B: B]¶
Mapping a function from A to B over the empty list yields the empty list of Bs.
Parameters¶
- f: {(val->A): val->B}[A, B] box
Returns¶
- Nil[B] val
flat_map[B: B]¶
Flatmapping a function from A to B over the empty list yields the empty list of Bs.
Parameters¶
- f: {(val->A): List[B]}[A, B] box
Returns¶
- Nil[B] val
for_each¶
Applying a function to every member of the empty list is a no-op.
Parameters¶
- f: {(val->A)}[A] box
Returns¶
- None val
filter¶
Filtering the empty list yields the empty list.
Parameters¶
- f: {(val->A): Bool}[A] box
Returns¶
- Nil[A] val
fold[B: B]¶
Folding over the empty list yields the initial accumulator.
Parameters¶
- f: {(B, val->A): B^}[A, B] box
- acc: B
Returns¶
- B
every¶
Any predicate is true of every member of the empty list.
Parameters¶
- f: {(val->A): Bool}[A] box
Returns¶
- Bool val
exists¶
For any predicate, there is no element that satisfies it in the empty list.
Parameters¶
- f: {(val->A): Bool}[A] box
Returns¶
- Bool val
partition¶
The only partition of the empty list is two empty lists.
Parameters¶
- f: {(val->A): Bool}[A] box
Returns¶
drop¶
There are no elements to drop from the empty list.
Parameters¶
- n: USize val
Returns¶
- Nil[A] val
drop_while¶
There are no elements to drop from the empty list.
Parameters¶
- f: {(val->A): Bool}[A] box
Returns¶
- Nil[A] val
take¶
There are no elements to take from the empty list.
Parameters¶
- n: USize val
Returns¶
- Nil[A] val
take_while¶
There are no elements to take from the empty list.
Parameters¶
- f: {(val->A): Bool}[A] box
Returns¶
- Nil[A] val
contains[optional T: (A & HasEq[A!] #read)]¶
Parameters¶
- a: val->T
Returns¶
- Bool val
eq¶
Parameters¶
- that: Nil[A] val
Returns¶
- Bool val
ne¶
Parameters¶
- that: Nil[A] val
Returns¶
- Bool val