Data update

This commit is contained in:
Ingy döt Net 2025-08-11 18:05:26 -07:00
parent 4d5544505c
commit 4924dd0264
3073 changed files with 55820 additions and 4408 deletions

View file

@ -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'

View file

@ -0,0 +1,4 @@
stack = {}
table.insert(stack, 11) -- push
table.remove(stack) -- pop
print(#stack == 0) -- empty

View file

@ -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.*/

View file

@ -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)

View 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

View 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