Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
23
Task/Stack/Lingo/stack.lingo
Normal file
23
Task/Stack/Lingo/stack.lingo
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
-- parent script "Stack"
|
||||
|
||||
property _tos
|
||||
|
||||
on push (me, data)
|
||||
me._tos = [#data:data, #next:me._tos]
|
||||
end
|
||||
|
||||
on pop (me)
|
||||
if voidP(me._tos) then return VOID
|
||||
data = me._tos.data
|
||||
me._tos = me._tos.next
|
||||
return data
|
||||
end
|
||||
|
||||
on peek (me)
|
||||
if voidP(me._tos) then return VOID
|
||||
return me._tos.data
|
||||
end
|
||||
|
||||
on empty (me)
|
||||
return voidP(me.peek())
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue