Stack: first in last out?

Monkey Forums/Monkey Programming/Stack: first in last out?

AdamRedwoods(Posted 2013) [#1]
Does the current stack module do a first-in last-out? Surprised I don't see it.
Could use a "PopLast:T()" for queues, but i suppose you'd need another variable to track location of both ends, to avoid costly list iterations. Or pre-define a FILO over FIFO.
Should I just use a list?


Gerry Quinn(Posted 2013) [#2]
First-in last-out is the standard for stacks. There is a ring buffer class for first-in first-out.

I don't think Monkey has a deque class as yet, but maybe one could make one from an adapted ring buffer.


AdamRedwoods(Posted 2013) [#3]
sorry! I meant FIFO!
you're right, FILO is standard. i'll look a the ring buffer and see what it has.


dmaz(Posted 2013) [#4]