Data.Stack
- Package
- purescript-stack
- Repository
- ashutoshdas96/purescript-stack
Stack data structure and associated operations
A stack is a basic data structure that can be logically thought as linear structure represented by a real physical stack or pile, a structure where insertion and deletion of items takes place at one end called top of the stack.
In other words, a 'Stack' is an abstract data type that serves as a collection of elements, with two principal operations: 'stackPush', which adds an element to the collection, and 'stackPop', which removes the most recently added element that was not yet removed.
<https://upload.wikimedia.org/wikipedia/commons/b/b4/Lifo_stack.png>
See also https://en.wikipedia.org/wiki/Stack_(abstract_data_type)
#stackIsEmpty Source
stackIsEmpty :: forall a. Stack a -> Boolean
/O(1)/. Test if stack is empty
stackIsEmpty stackNew == true (∀x)(∀s)(stackIsEmpty (stackPush s x) == false) (∀s)((stackSize s == 0) ⇔ (stackIsEmpty s == true))
- Modules
- Data.
Stack