Doubly-linked list/Element definition: Difference between revisions

Content added Content deleted
m (→‎{{header|REXX}}: moved comment box outside of program, elided OVERFLOW from the html PRE tag.)
m (→‎{{header|REXX}}: changed boxed comments.)
Line 654: Line 654:
=={{header|REXX}}==
=={{header|REXX}}==
REXX doesn't have linked lists, as there are no pointers (or handles).
REXX doesn't have linked lists, as there are no pointers (or handles).
<br>However, linked lists can be simulated with lists in REXX.
<br>

However, linked lists can be simulated with lists in REXX.
╔═════════════════════════════════════════════════════════════════════════╗
┌────────────────────────────────────────────────────────────────────┐
┌─┘ Functions of the List Manager └─┐
☼☼☼☼☼☼☼☼☼☼☼ Functions of the List Manager ☼☼☼☼☼☼☼☼☼☼☼
@init ─── initializes the List.
@init ─── initializes the List.
@size ─── returns the size of the List [could be a 0 (zero)].
│ @size ─── returns the size of the List [could be 0 (zero)]. │
@show ─── shows (displays) the complete List.
@show ─── shows (displays) the complete List.
║ @show k,1 ─── shows (displays) the Kth item.
║ @show k,m ─── shows (displays) M items, starting with Kth item.
│ @show k,1 ─── shows (displays) the Kth item. │
@show k,m ─── shows (displays) M items, starting with Kth item.
@show ,,─1 ─── shows (displays) the complete List backwards.
║ ║
│ @show ,,─1 ─── shows (displays) the complete List backwards. │
@get k ─── returns the Kth item.
│ @get k ─── returns the Kth item.
@get k,m ─── returns the M items starting with the Kth item.
║ ║
@get k,m ─── returns the M items starting with the Kth item.
@put x ─── adds the X items to the end (tail) of the List.
@put x ─── adds the X items to the end (tail) of the List.
@put x,0 ─── adds the X items to the start (head) of the List.
@put x,0 ─── adds the X items to the start (head) of the List.
@put x,k ─── adds the X items to before of the Kth item.
║ ║
│ @put x,k ─── adds the X items to before of the Kth item. │
@del k ─── deletes the item K.
@del k ─── deletes the item K.
@del k,m ─── deletes the M items starting with item K.
╚═════════════════════════════════════════════════════════════════════════╝
│ @del k,m ─── deletes the M items starting with item K. │
└─┐ ┌─┘
└────────────────────────────────────────────────────────────────────┘
<lang rexx>/*REXX program that implements various List Manager functions. */
<lang rexx>/*REXX program that implements various List Manager functions. */
call sy 'initializing the list.' ; call @init
call sy 'initializing the list.' ; call @init