From: Martin DeMello Date: 2002-11-30T03:57:28+09:00 Subject: Re: RCR: Stack, Queue alias methods in Array "Pe?a, Botp" wrote: > [snipped lots of good args by kent and martin] > > maybe we can name methods by the way we access them (and not on its form). > top/bottom are too generic/ambiguous since we can turn array upside-down > anytime :-) true :) > try fifo/lifo. so we have fifo#in, fifo#out, lifo#in, lifo#out... stack and queue are the more usual name, though. and the method names should be the usual names for *operations* on stacks and queues. the problem is, 'peek at the top element' is not (as far as i know, anyway) technically a valid stack operation - strictly, you should use 'stack.push(a = stack.pop)'. does any language with a Stack class define this method? the literature usually refers to the top of a stack, and the head and tail of a queue, hence my proposed method names. martin