Data update
This commit is contained in:
parent
4d5544505c
commit
4924dd0264
3073 changed files with 55820 additions and 4408 deletions
|
|
@ -1,6 +1,9 @@
|
|||
stack = .queue~of(123, 234) -- creates a stack with a couple of items
|
||||
stack~push("Abc") -- pushing
|
||||
value = stack~pull -- popping
|
||||
say 'popped:' value
|
||||
value = stack~peek -- peeking
|
||||
say 'peeked:' value
|
||||
-- the is empty test
|
||||
if stack~isEmpty then say "The stack is empty"
|
||||
Else say stack~items 'items are on the stack'
|
||||
|
|
|
|||
4
Task/Stack/Pluto/stack.pluto
Normal file
4
Task/Stack/Pluto/stack.pluto
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
stack = {}
|
||||
table.insert(stack, 11) -- push
|
||||
table.remove(stack) -- pop
|
||||
print(#stack == 0) -- empty
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
y=123 /*define a REXX variable, value is 123 */
|
||||
push y /*pushes 123 onto the stack. */
|
||||
pull g /*pops last value stacked & removes it. */
|
||||
q=empty() /*invokes the EMPTY subroutine (below)*/
|
||||
exit /*stick a fork in it, we're done. */
|
||||
|
||||
empty: return queued() /*subroutine returns # of stacked items.*/
|
||||
|
|
@ -3,10 +3,10 @@
|
|||
* 11.08.2013 Walter Pachl
|
||||
**********************************************************************/
|
||||
stk.=0
|
||||
Call push 123
|
||||
Call push 123 /*pushes 123 onto the stack. */
|
||||
Say empty()
|
||||
say peek()
|
||||
say pull()
|
||||
say pull() /*pops last value stacked & removes it. */
|
||||
Say empty()
|
||||
say peek()
|
||||
say push(456)
|
||||
6
Task/Stack/TAV/stack-1.tav
Normal file
6
Task/Stack/TAV/stack-1.tav
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
row (@) push (val):
|
||||
@[@.Count+1] =: val \ increments .Count
|
||||
row (@) pop:
|
||||
rv =: @[@.Count] \ void if .Count = 0
|
||||
@[@.Count] =: () \ assigning void decrements .Count
|
||||
:> rv
|
||||
9
Task/Stack/TAV/stack-2.tav
Normal file
9
Task/Stack/TAV/stack-2.tav
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
main(params):+
|
||||
stack =: new row \ a row is a nice stack
|
||||
?# v =: tuple 1,3,5,7,11,13 give values
|
||||
row stack push v \ push some primes
|
||||
print '*' _ stack[stack.Count] \ get top
|
||||
?# i =: from 1 upto 7
|
||||
? i %% 3 = 0
|
||||
print '*' _ stack[stack.Count]
|
||||
print stack::pop \ class function syntax used
|
||||
Loading…
Add table
Add a link
Reference in a new issue