Doubly-linked list/Element definition: Difference between revisions
Doubly-linked list/Element definition (view source)
Revision as of 21:55, 8 February 2017
, 7 years agoMoved PL/I below PicoLisp
m (Moved PL/I below PicoLisp) |
|||
Line 583:
Memory is automatically reclaimed the moment items are no longer needed.
=={{header|PL/I}}==▼
<lang PL/I>▼
define structure▼
1 Node,▼
2 value fixed decimal,▼
2 back_pointer handle(Node),▼
2 fwd_pointer handle(Node);▼
P = NEW(: Node :); /* Creates a node, and lets P point at it. */▼
get (P => value); /* Reads in a value to the node we just created. */▼
/* Assuming that back_pointer and fwd_pointer point at other nodes, */▼
/* we can say ... */▼
P = P => fwd_pointer; /* P now points at the next node. */▼
...▼
P = P => back_pointer; /* P now points at the previous node. */▼
</lang>▼
=={{header|PicoLisp}}==
Line 626 ⟶ 608:
(2cons 'not *DLst)</lang>
For output of the example data, see [[Doubly-linked list/Traversal#PicoLisp]].
▲=={{header|PL/I}}==
▲<lang PL/I>
▲define structure
▲ 1 Node,
▲ 2 value fixed decimal,
▲ 2 back_pointer handle(Node),
▲ 2 fwd_pointer handle(Node);
▲P = NEW(: Node :); /* Creates a node, and lets P point at it. */
▲get (P => value); /* Reads in a value to the node we just created. */
▲/* Assuming that back_pointer and fwd_pointer point at other nodes, */
▲/* we can say ... */
▲P = P => fwd_pointer; /* P now points at the next node. */
▲...
▲P = P => back_pointer; /* P now points at the previous node. */
▲</lang>
=={{header|Pop11}}==
|