Mauricio Fern?ndez <batsman.geo / yahoo.com> wrote:
>> 
>> Okay (: I've seen one that was covered from the top, but you could open
>> the curved face and put in cups. Supermarket shopping cart rails are
>> an example of a horizontal stack too - you slide in carts and remove the
>> last slid-in one. So there're even more options than top and bottom :)
> 
> Ummm, I have also seen this implemented as a queue :-) Access to its
> elements was unprotected, though (no coin); I believe this kind of
> access control can only be done straightforwardly with stacks.

Airport access control uses a queue, I think - you can insert used carts
from one end, but that end has a sort of one-way valve that prevents
them from being extracted.
 
> I hereby propose a pointless competition (like all the good ones! ;) on
> reports of use of stacks and associated structures IRL.

Puzzle: There's a common occurrence of a doubly broken abstraction.
Physically, the structure most resembles a stack; that is, inserting and
removing are both trivial from the front end. However, people of one
type go out of their way to insert objects in the back end, trying to
convert the stack into a queue. And after that, the other class of
people go out of their way to *remove* objects from the back end,
turning the queue into a stack facing the other way, even though
insertion and deletion from that end are both O(n). What am I talking
about?
 
> BTW, I believe nobody thought about the following, even though it is one
> we are all exposed daily to:
> 
> my desk is a stack, too. Papers and stuff get stacked, and I can easily
> peek at the topmost element. My desk-stack is able to hold objects of
> different types, as there's no static type checking. There's however
> a set of constraints on which types can be stacked over. To reach a
> deeper understanding of these typing issues, I performed the following
> experiment on the table to my left (just as I typed these words)
> 1) push CD
> 2) push CD -> structure is stable
> 3) push cardboard box -> type of this object == CardboardBox 
> 4) push set of 50 CDs inside plastic box
> ==>  SURPRISE!!! the type of object (3) has changed to FlattenedCardboardBox
> 5) push apple
> 6) push Blue Book (Smalltalk 80, The Language and Its Implementation)
> ==> an UnstableStack Exception is thrown.

LOL!

martin