RosettaCodeData/Task/Stack/Slate/stack.slate
Ingy döt Net 68f8f3e56b all tasks
2013-04-11 01:07:29 -07:00

22 lines
460 B
Text

collections define: #Stack &parents: {ExtensibleArray}.
"An abstraction over ExtensibleArray implementations to follow the stack
protocol. The convention is that the Sequence indices run least-to-greatest
from bottom to top."
s@(Stack traits) push: obj
[s addLast: obj].
s@(Stack traits) pop
[s removeLast].
s@(Stack traits) pop: n
[s removeLast: n].
s@(Stack traits) top
[s last].
s@(Stack traits) top: n
[s last: n].
s@(Stack traits) bottom
[s first].