Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Functor ¶
type Functor func(interface{}) interface{}
Functor is a function capable of modifying stack elements.
type ImmutableStack ¶
type ImmutableStack interface { // Top returns the top element on the stack. Top() interface{} // Pop returns the next substack. Pop() ImmutableStack // Size returns the size of the stack. Size() uint64 // Push pushes a new element onto the stack and returns a new stack. Push(interface{}) ImmutableStack // ForEach iterates over the stack and applies the iterator function to each // substack until it finds the empty one or the iterator returns an error. ForEach(Iterator) // FMap applies a function to each element on the stack and returns the new // stack with results of the function application. FMap(f Functor) ImmutableStack }
ImmutableStack is an abstract immutable LIFO data structure.
type Iterator ¶
type Iterator func(ImmutableStack) error
Iterator is a function taking a each substack of a given stack. It can return an error to break iteration.
Click to show internal directories.
Click to hide internal directories.