(define top-minus
(lambda (ra-stack offset)
(cond ((< offset 0)
(error "TOP-MINUS: offset < 0" offset))
((>= offset (height ra-stack))
(error
"TOP-MINUS: offset too large for stack"
offset (height ra-stack)))
(else
(vector-ref (cells ra-stack) (- (height ra-stack)
(+ offset 1)))))))
top-minus relies on the following
invariant implied by this representation:
The elements of ra-stack, listed from the bottom of the stack to its top, are in cells[0], cells[1], ..., cells[height-1].The RA-stack mutators push! and pop! must be sure to maintain this invariant.