immutablestack: Index | Files

package immutablestack

import ""


Package Files


type Functor Uses

type Functor func(interface{}) interface{}

Functor is a function capable of modifying stack elements.

type ImmutableStack Uses

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.

    // 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.

func New Uses

func New() ImmutableStack

New returns a new instance of ImmutableStack.

type Iterator Uses

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.

Updated 2016-07-16. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).