Doubly-linked list/Traversal: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: added whitespace, added DO-END comment label, indented DO loop. -- ~~~~) |
m (→{{header|REXX}}: consolidated annotation with the "calling" statements. -- ~~~~) |
||
Line 870: | Line 870: | ||
└─┐ ┌─┘ |
└─┐ ┌─┘ |
||
└────────────────────────────────────────────────────────────────────┘*/ |
└────────────────────────────────────────────────────────────────────┘*/ |
||
call sy 'initializing the list.' ; call @init |
|||
call sy 'building list: Was it a cat I saw'; call @put 'Was it a cat I saw' |
|||
call @init |
|||
call sy 'displaying list size.' ; say 'list size='@size() |
|||
⚫ | |||
call @put 'Was it a cat I saw' |
|||
call sy 'backward list' ; call @show ,,-1 |
|||
call sy 'showing 4th item' ; call @show 4,1 |
|||
say 'list size='@size() |
|||
call sy 'showing 6th & 6th items' ; call @show 5,2 |
|||
⚫ | |||
call @show |
|||
call sy 'showing list' ; call @show |
|||
⚫ | |||
call @show ,,-1 |
|||
call sy 'showing list' ; call @show |
|||
call sy 'adding to head: Oy!' ; call @put 'Oy!',0 |
|||
call @show 4,1 |
|||
call sy 'showing list' ; call @show |
|||
call @show 5,2 |
|||
⚫ | |||
call @put 'black',4 |
|||
⚫ | |||
call @show |
|||
call sy 'adding to tail: there, in the ...' |
|||
⚫ | |||
call sy 'showing list' |
|||
call @show |
|||
call sy 'adding to head: Oy!' |
|||
call @put 'Oy!',0 |
|||
call sy 'showing list' |
|||
call @show |
|||
exit /*stick a fork in it, we're done.*/ |
exit /*stick a fork in it, we're done.*/ |
||
/*──────────────────────────────────subroutines─────────────────────────*/ |
/*──────────────────────────────────subroutines─────────────────────────*/ |