Kent Dahl <kentda / stud.ntnu.no> wrote:
> Martin DeMello wrote:
>> 
>> Yukihiro Matsumoto <matz / ruby-lang.org> wrote:
>> > Not for me.  I probably have to answer to the question "why top is
>> > last?" thousand times in the future.  ;-)
>> 
>> I just realised that the whole reason I wanted this was that it doesn't
>> mater which end it is :) It's just "the same end as push and pop".
> 
> Then you really don't want 'top', you want 'peek', as in "get value pop
> would return, but don't pop it off". 

But 'peek' really is too generic - it could also mean 'get value shift
would return', 'expose the internal data structure' and probably a
couple of other things (remember BASIC's 'peek'?)

> <digression>
> Having too many free braincycles doing the dishes, I started wondering
> why the blazes what is the top or bottom of a stack should have anything
> to do with anything. I can put the next clean plate on top the other
> clean ones, but that doesn't look like a push to me. Now, when I get the
> (crazy) idea of putting them at the _bottom_ of the stack of plates, to
> be sure to rotate and distribute the wear and tear on the plates, that,
> by any definition, is one big push. Just ask my weak, geeky arms. 
> </digression>

Cafeterias, for example, use push-down stacks of plates. The plates sit
in a vertical cage, with a spring at the bottom, so that the top plate
is always at the same height. You literally push in a plate - the others
get pushed downwards and teh spring compresses, and likewise you can
only remove the top plate.

martin