RosettaCodeData/Task/Stack/Slate/stack.slate

23 lines
460 B
Plaintext

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].