24 lines
391 B
Plaintext
24 lines
391 B
Plaintext
Stack: $[]-> []
|
|
|
|
pushTo: function [st val]-> 'st ++ val
|
|
popStack: function [st] [
|
|
result: last st
|
|
remove 'st .index (size st)-1
|
|
return result
|
|
]
|
|
emptyStack: function [st]-> empty 'st
|
|
printStack: function [st]-> print st
|
|
|
|
st: new Stack
|
|
|
|
pushTo st "one"
|
|
pushTo st "two"
|
|
pushTo st "three"
|
|
printStack st
|
|
|
|
print popStack st
|
|
printStack st
|
|
|
|
emptyStack st
|
|
print ["finally:" st]
|