%mathpiper,def="PopBack"

Function("PopBack",{stack})  Pop(stack,Length(stack));

%/mathpiper



%mathpiper_docs,name="PopBack",categories="User Functions;Lists (Operations)"
*CMD PopBack --- remove an element from the bottom of a stack
*STD
*CALL
	PopBack(stack)

*PARMS

{stack} -- a list (which serves as the stack container)

*DESC

This is part of a simple implementation of a stack, internally
represented as a list. This command removes the element at the bottom
of the stack and returns this element. Of course, the stack should not
be empty.

*E.G.

In> stack := {};
Result: {};
In> Push(stack, x);
Result: {x};
In> Push(stack, x2);
Result: {x2,x};
In> Push(stack, x3);
Result: {x3,x2,x};
In> PopBack(stack);
Result: x;
In> stack;
Result: {x3,x2};

*SEE Push, Pop, PopFront
%/mathpiper_docs