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 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 'building list: Was it a cat I saw'
call sy 'displaying list size.' ; say 'list size='@size()
call sy 'forward list' ; call @show
call @put 'Was it a cat I saw'
call sy 'displaying list size.'
call sy 'backward list' ; call @show ,,-1
call sy 'showing 4th item' ; call @show 4,1
say 'list size='@size()
call sy 'forward list'
call sy 'showing 6th & 6th items' ; call @show 5,2
call sy 'adding item before item 4: black' ; call @put 'black',4
call @show
call sy 'backward list'
call sy 'showing list' ; call @show
call sy 'adding to tail: there, in the ...'; call @put 'there, in the shadows, stalking its prey (and next meal).'
call @show ,,-1
call sy 'showing 4th item'
call sy 'showing list' ; call @show
call sy 'adding to head: Oy!' ; call @put 'Oy!',0
call @show 4,1
call sy 'showing 6th & 6th items'
call sy 'showing list' ; call @show
call @show 5,2
call sy 'adding item before item 4: black'
call @put 'black',4
call sy 'showing list'
call @show
call sy 'adding to tail: there, in the ...'
call @put 'there, in the shadows, stalking its prey (and next meal).'
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─────────────────────────*/