previous | index | next

RA-stack Operations in Scheme

     (make-ra-stack)
       ;returns a newly created empty stack.

     (empty-ra-stack? ra-stack)
       ;returns #T if ra-stack is empty,
       ;otherwise #F.

     (height ra-stack)
       ;returns the height (i.e., number of
       ;elements) in ra-stack.

     (top-minus ra-stack offset)
       ;returns the element which is offset items
       ;below the top of ra-stack, provided
       ;0 ≤ offset < (height ra-stack).
       ;In particular, (top-minus ra-stack 0)
       ;returns the top of ra-stack, provided
       ;ra-stack is non-empty.

     (pop! ra-stack)
       ;removes the top element of ra-stack,
       ;provided ra-stack is non-empty.
       ;Return value is the modified ra-stack.

     (push! ra-stack item)
       ;pushes item onto the top of ra-stack.
       ;Return value is the modified ra-stack.

previous | index | next