stack - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


stack

Stack Data Structure

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

stack[new]()

stack[new](x1, ..., xn)

stack[push](x, s)

stack[pop](s)

stack[empty](s)

stack[top](s)

stack[depth](s)

Parameters

s

-

stack

x, x[i]

-

values to be inserted into the stack

Description

• 

Important: The stack command has been deprecated. Use the superseding command DEQueue instead.

• 

The call stack[new]() returns an empty stack. The call stack[new](x1, ..., xn) returns a stack with the values x1, ..., xn on the stack with x1 on the top of the stack.

• 

The call stack[push](x, s) puts x on the top of the stack s while stack[pop](s) returns (and removes) the top element from the stack.

• 

The call stack[empty](s) returns true if the stack s is empty, and false if it is not empty.

• 

Additionally, stack[top](s) returns the top element of the stack (but does not remove it) and stack[depth](s) returns the number of elements in the stack.

• 

An object-oriented stack implementation is available via the Stack constructor.

Examples

Important: The stack command has been deprecated. Use the superseding command DEQueue instead.

sstacknewgreg,tony,bruno,michael:

stackpushstefan,s

stefan

(1)

stackdepths

5

(2)

stacktops

stefan

(3)

whilenotstackemptysdostackpopsenddo

greg

(4)

See Also

DEQueue

priqueue

Stack