Yukihiro Matsumoto <matz / ruby-lang.org> wrote:
> Hi,
> 
> In message "RCR: Stack, Queue alias methods in Array"
>    on 02/11/26, Martin DeMello <martindemello / yahoo.com> writes:
> 
> |Proposed aliases:
> |
> |top <- last
> |enqueue, append <- push
> |dequeue <- shift
> |head <- [0]
> |tail <- last
> 
> top      "top" returns last item?  probably confusing.
> append   we already have append.

Oops, so we do. 'dequeue' is the natural opposite, then.

> enqueue  possible, interesting, little bit hard to remember the spell.
> dequeue  ditto.

They're the usual textbook terms for queue operations, though, so it'll
be familiar to at least some fraction of people. Texts tend to vary
between 'enqueue' and 'append', but they all use 'dequeue' for the
"inverse" operation (not really an inverse, since a.enqueue(a.dequeue)
!= a)

> head     maybe, but..
> tail     some may feel "tail" must return everything but first.

There's always cdr for that :)

martin