procedure main() stack := [] # new empty stack push(stack,1) # add item push(stack,"hello",table(),set(),[],5) # add more items of mixed types in order left to right y := top(stack) # peek x := pop(stack) # remove item write("The stack is ",if isempty(stack) then "empty" else "not empty") end procedure isempty(x) #: test if a datum is empty, return the datum or fail (task requirement) if *x = 0 then return x # in practice just write *x = 0 or *x ~= 0 for is/isn't empty end procedure top(x) #: return top element w/o changing stack return x[1] # in practice, just use x[1] end