Specify the behavior using Guttag's axiomatic method. Use ML as a specification language, and test your specs by executing them on some test data.
(1) ring
this is a form of bounded queue; if the ring is full, and you add an item, then
it stomps the oldest item (the one at the head). You can think of the finite number
of elements being in a ring, and you keep adding around the ring.
(2) stomp stack
a bounded stack; when you push an item on a full stack, it "mashes" the bottom item out
to make room at the top
(3) priority stack
the stack contains items that are pairs: an element, and an integer priority
0 is low priority
when you push as item, it percolates down toward the stack bottom until it hits an item with
lower priority... and it stays there on top it that lower priority item.
(4) debtset
this is a multiset (bag) in that an element can be added more than once
however, an element can also be removed when its not there... this creates
a "debt" or a negative count.
the operation "remAll" causes all copies of an item to be removed; if the for remAll is not there
it stays not there; if the item for remAll has a negative count, then the count stays the same