Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
42
Task/Stack/NetRexx/stack.netrexx
Normal file
42
Task/Stack/NetRexx/stack.netrexx
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/* NetRexx ************************************************************
|
||||
* 13.08.2013 Walter Pachl translated from REXX version 2
|
||||
**********************************************************************/
|
||||
options replace format comments java crossref savelog symbols nobinary
|
||||
|
||||
stk = create_stk
|
||||
|
||||
say push(stk,123) 'from push'
|
||||
say empty(stk)
|
||||
say peek(stk) 'from peek'
|
||||
say pull(stk) 'from pull'
|
||||
say empty(stk)
|
||||
Say pull(stk) 'from pull'
|
||||
|
||||
method create_stk static returns Rexx
|
||||
stk = ''
|
||||
stk[0] = 0
|
||||
return stk
|
||||
|
||||
method push(stk,v) static
|
||||
stk[0]=stk[0]+1
|
||||
stk[stk[0]]=v
|
||||
Return v
|
||||
|
||||
method peek(stk) static
|
||||
x=stk[0]
|
||||
If x=0 Then
|
||||
Return 'stk is empty'
|
||||
Else
|
||||
Return stk[x]
|
||||
|
||||
method pull(stk) static
|
||||
x=stk[0]
|
||||
If x=0 Then
|
||||
Return 'stk is empty'
|
||||
Else Do
|
||||
stk[0]=stk[0]-1
|
||||
Return stk[x]
|
||||
End
|
||||
|
||||
method empty(stk) static
|
||||
Return stk[0]=0
|
||||
Loading…
Add table
Add a link
Reference in a new issue