stack

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2022 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package stack implements the Stack type.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stack

type Stack struct {
	Slice []number.Number
}

Stack is a last-in-first-out stack of Numbers.

func New

func New(ns ...number.Number) *Stack

New returns a new Stack.

func (*Stack) Empty

func (s *Stack) Empty() bool

Empty returns true if the Stack is empty.

func (*Stack) End

func (s *Stack) End() int

End returns the index of the top Number on the Stack.

func (*Stack) Len

func (s *Stack) Len() int

Len returns the length of the Stack.

func (*Stack) Pop

func (s *Stack) Pop() number.Number

Pop removes and returns the top Number on the Stack.

func (*Stack) Push

func (s *Stack) Push(n number.Number)

Push appends a Number to the top of the Stack.

func (*Stack) String

func (s *Stack) String() string

String returns the Stack as a string.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL