Provides FIFO queue (stack) operations.
stack is a set of procedures and macros supporting FIFO queue operations. The stack is treated as an independent object, which is modified in place. In opposition to the common pattern of a variable being re-assinged a new stack representation after each mutating operation.
Returns a new, empty, stack.
Returns #t for a stack STACK, #f otherwise. Not fool-proof!
Returns #t for an empty stack STACK, #f otherwise.
Returns the number of elements on the stack STACK.
Returns the element in stack STACK at index INDEX. Index must be 0 <= & <= (stack-length)-1, defaults to 0 (top of stack).
Changes the stack STACK element at index INDEX to value VALUE. Returns the modified stack. The stack is modified in place. Index must be 0 <= & <= (stack-length)-1, defaults to 0 (top of stack)
Pushes value(s) VALUE onto the stack STACK. Returns the modified stack. The stack is modified in place.
Removes the top element from the stack STACK and returns it. The stack is modified in place.
Removes the stack elements from start-depth START-DEPTH thru end-depth END-DEPTH and returns a list of the stack elements. The stack is modified in place. The start-depth must be 0 <= & <= (stack-length)-1. The end-depth must be start-depth <= & <= (stack-length)-1, defaults to start-depth.
Returns the list LIST as a stack. The resulting stack may share memory with the list and the list should not be modified after this operation.
Returns the stack STACK as a list, where the first element of the list is the top element of the stack. The resulting list may share memory with the queue object and should not be modified.
Applies the procedure PROCEDURE to each element of the stack STACK, in order of top to bottom.
Prints the elements of the stack STACK to the (current-output-port).