Using Icon lists as queues |
|
We have seen how the ``push()'' and ``pop()''
function aid in
`Using Icon lists as stacks'.
Two more functions allow elements to be added and removed from the
end of any list:
put(L, x)'' adds x after
the old last element of list L.
pull(L)'' removes the last element from
list L and returns the value removed.
To sum up, here is a picture of how the four stack and queue functions in Icon work:
push --> +--------+--------+-------+--------+ <-- put
| L[1] | L[2] | ... | L[*L] |
pop <-- +--------+--------+-------+--------+ --> pull
|
John Shipman, john@nmt.edu
Last updated: 1996/01/06 21:12:57 UT URL: http://www.nmt.edu/tcc/help/lang/icon/queuelist.html |
|