Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
15
Task/Stack/Forth/stack.fth
Normal file
15
Task/Stack/Forth/stack.fth
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
: stack ( size -- )
|
||||
create here cell+ , cells allot ;
|
||||
|
||||
: push ( n st -- ) tuck @ ! cell swap +! ;
|
||||
: pop ( st -- n ) -cell over +! @ @ ;
|
||||
: empty? ( st -- ? ) dup @ - cell+ 0= ;
|
||||
|
||||
10 stack st
|
||||
|
||||
1 st push
|
||||
2 st push
|
||||
3 st push
|
||||
st empty? . \ 0 (false)
|
||||
st pop . st pop . st pop . \ 3 2 1
|
||||
st empty? . \ -1 (true)
|
||||
Loading…
Add table
Add a link
Reference in a new issue