Doubly-linked list/Element definition: Difference between revisions

m
(→‎{{header|Kotlin}}: Updated example see https://github.com/dkandalov/rosettacode-kotlin for details)
Line 651:
With that, 'cddr' can be used to access the next, and 'cadr' to access the
previous element.
<lang PicoLisp># 'cons' an element to a doubly-linked list
(de 2cons2head (X DLst)
(let L (car DLst) # Get current data list
(set DLst (cons X NIL L)) # Prepend two new cons pairs
Line 660:
 
# We prepend 'not' to the list in the previous example
(2cons2head 'not *DLst)</lang>
For output of the example data, see [[Doubly-linked list/Traversal#PicoLisp]].
 
298

edits