HELP NEWQUEUE J L Cunningham Feb 82
Revised John Gibson Aug 93
------------------------------ NOTE ------------------------------------
From Version 14.5, a change has been made to LIB * NEWQUEUE which
makes it incompatible with previous versions: the old procedure names
QLIST and QLENGTH are replaced by QUEUELIST and QUEUELENGTH
respectively.
------------------------------------------------------------------------
The procedure NEWQUEUE can be used to create "queues". The queue is a
procedure which can be assigned to, to add an item to the end of the
queue, or can be called to return the next item from the front of the
queue. For example:
vars q1;
newqueue([any initial items]) -> q1;
q1()=>
** any
[a list] -> q1();
[another list] -> q1();
repeat 5 times q1()=> endrepeat;
** initial
** items
** [a list]
** [another list]
** <termin>
The argument to NEWQUEUE is used as the initial queue. If the next item
is required from an empty queue, then TERMIN is returned.
Additional procedures defined in LIB NEWQUEUE are:
QUEUELIST(Q)
Returns the internal list used to store the items in queue
Q. Has an updater, so can be used to replace the QUEUELIST.
QUEUELENGTH(Q)
Length of the QUEUELIST.
PRQUEUE(Q)
Prints a queue.
Note that when NEWQUEUE is first called, it redefines PR using *NEWPR,
to use PRQUEUE on queues.
--- C.all/help/newqueue
--- Copyright University of Sussex 1992. All rights reserved. ----------Author: J L Cunningham Feb 82