a-synchronous / a-synchronous/rubico
rubico/monad/Stack
- Lingua principale
- JavaScript
- Stelle
- 283
- Fork
- 17
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
## Stack
the stack data structure
## synopsis
```coffeescript
new Stack(values Iterable|any) -> Stack {
map: function,
concat: function,
chain: function,
push: function,
pop: function,
top: function,
}
```
## description
A **Stack** is a data structure that supports `push` and `pop` operations in O(1) time as well as monadic operations that enable iteration, concatenation, and flattening. Items pushed onto a stack are first in last out (FILO).
```javascript [playground]
const myStack = new Stack([1, 2, 3])
console.log(myStack) // Stack [1, 2, 3]
myStack.push(4)
myStack.push(5)
myStack.push(6)
console.log(myStack) // Stack [1, 2, 3, 4, 5, 6]
console.log(myStack.pop()) // 6
```
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.