Doubly-linked list/Element insertion: Difference between revisions

Content added Content deleted
Line 66: Line 66:
);
);


# BEGIN rosettacode task code specimen:
# BEGIN rosettacode task specimen code:
can also insert both before the first, and after the last link #
can handle insert both before the first, and after the last link #

PROC insert after = (REF LINK #self,# prev, DATA new data)LINK: (
PROC insert after = (REF LINK #self,# prev, DATA new data)LINK: (
# DOWN do link OF splice OF self; to make thread safe #
# DOWN do link OF splice OF self; to make thread safe #
Line 76: Line 77:
new link
new link
);
);

# END rosettacode task code specimen #
PROC insert before = (REF LINK #self,# next, DATA new data)LINK:
insert after(#self,# prev OF next, new data);

# END rosettacode task specimen code #


# Test case: #
# Test case: #