The empty list of As.
primitive val Nil[A: A] is ReadSeq[val->A] box
new val create() : Nil[A] val^
Returns the size of the list.
fun box size() : USize val
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.
fun box apply( i: USize val) : val->A ?
Returns an empty iterator over the elements of the empty list.
fun box values() : Iterator[val->A] ref^
Returns a Bool indicating if the list is empty.
fun box is_empty() : Bool val
Returns a Bool indicating if the list is non-empty.
fun box is_non_empty() : Bool val
Returns an error, since Nil has no head.
fun box head() : val->A ?
Returns an error, since Nil has no tail.
fun box tail() : (Cons[A] val | Nil[A] val) ?
The reverse of the empty list is the empty list.
fun box reverse() : Nil[A] val
Builds a new list with an element added to the front of this list.
fun box prepend( a: val->A!) : Cons[A] val
The concatenation of any list l with the empty list is l.
fun box concat( l: (Cons[A] val | Nil[A] val)) : (Cons[A] val | Nil[A] val)
Mapping a function from A to B over the empty list yields the empty list of Bs.
fun box map[B: B]( f: {(val->A): val->B}[A, B] box) : Nil[B] val
Flatmapping a function from A to B over the empty list yields the empty list of Bs.
fun box flat_map[B: B]( f: {(val->A): List[B]}[A, B] box) : Nil[B] val
Applying a function to every member of the empty list is a no-op.
fun box for_each( f: {(val->A)}[A] box) : None val
Filtering the empty list yields the empty list.
fun box filter( f: {(val->A): Bool}[A] box) : Nil[A] val
Folding over the empty list yields the initial accumulator.
fun box fold[B: B]( f: {(B, val->A): B^}[A, B] box, acc: B) : B
Any predicate is true of every member of the empty list.
fun box every( f: {(val->A): Bool}[A] box) : Bool val
For any predicate, there is no element that satisfies it in the empty list.
fun box exists( f: {(val->A): Bool}[A] box) : Bool val
The only partition of the empty list is two empty lists.
fun box partition( f: {(val->A): Bool}[A] box) : (Nil[A] val , Nil[A] val)
There are no elements to drop from the empty list.
fun box drop( n: USize val) : Nil[A] val
There are no elements to drop from the empty list.
fun box drop_while( f: {(val->A): Bool}[A] box) : Nil[A] val
There are no elements to take from the empty list.
fun box take( n: USize val) : Nil[A] val
There are no elements to take from the empty list.
fun box take_while( f: {(val->A): Bool}[A] box) : Nil[A] val
fun val contains[optional T: (A & HasEq[A!] #read)]( a: val->T) : Bool val
fun box eq( that: Nil[A] val) : Bool val
fun box ne( that: Nil[A] val) : Bool val
© 2016-2018, The Pony Developers
© 2014-2015, Causality Ltd.
Licensed under the BSD 2-Clause License.
https://stdlib.ponylang.io/collections-persistent-Nil