Home / Docs / Standard library / Built-in methods
push
Release v0.4.0Edition 0.5 preview
A built-in method, resolved by the type of its receiver (spec/14 §2). Edition 0.5 preview.
una
edit s.push(item: T) -> Unit
where s: Stack[T]
edit q.push(item: T) -> Unit
where q: Queue[T]
edit q.push(item: T, priority: P) -> Unit
where q: PriorityQueue[T, P]Updates the receiver in place, written edit s.push(item: x): a Stack takes item on top and a Queue at its back, and its length grows by one, in O(1) amortized time (spec/28 §5). A PriorityQueue, written edit q.push(item: x, priority: p), takes item at priority, in O(log n) comparisons, amortized (spec/28 §8).
Specification
spec/28 §5spec/28 §8
Generated from una v0.4.0 (docs/std/builtins.json, which is not part of the specification): built-in methods have no declaration, so una writes these signature lines and tests each against its checker. The specification governs: spec/14 §2.