Doubly-linked list/Element removal: Difference between revisions
m
syntax highlighting fixup automation
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
|||
Line 10:
The user must type in the monitor the following command after compilation and before running the program!<pre>SET EndProg=*</pre>
{{libheader|Action! Tool Kit}}
<
INCLUDE "D2:ALLOCATE.ACT" ;from the Action! Tool Kit. You must type 'SET EndProg=*' from the monitor after compiling, but before running this program!
Line 98:
TestRemove(listEnd)
TestRemove(listBegin)
RETURN</
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Doubly-linked_list_element_removal.png Screenshot from Atari 8-bit computer]
Line 121:
=={{header|Ada}}==
<
with Ada.Text_Io;
Line 156:
Print_List (List);
end Element_Remove;</
{{out}}
<pre>cat dog hen horse
Line 163:
=={{header|ALGOL W}}==
Uses the element type and insertion method as in the [[Doubly-Linked List (traversal)]] task.
<
% record type to hold an element of a doubly linked list of integers %
record DListIElement ( reference(DListIElement) prev
Line 240:
end while_e_ne_null
end
end.</
{{out}}
<pre>
Line 265:
=={{header|Go}}==
Using the doubly-linked list from the container/list package and the Wren example:
<
import (
Line 290:
dll.Remove(e1) // remove "dog"
printDll("After removal 2", dll)
}</
{{out}}
Line 301:
=={{header|Julia}}==
Uses code from [[Doubly-Linked List (traversal)]]
<
value::T
pred::Union{DLNode{T}, Nothing}
Line 372:
delete(node2)
println("Then deleting node2 yields: "); printconnected(node1)
</
<pre>
From beginning to end: 1 -> 2 -> 3 -> 4
Line 383:
=={{header|Nim}}==
This is a simplified version of code from [[Doubly-Linked List (traversal)]]
<
DoublyLinkedList[T] = object
Line 439:
echo l
l.remove c
echo l</
{{out}}
Line 451:
=={{header|Phix}}==
Extended copy of [[Doubly-linked_list/Traversal#Phix]]
<!--<
<span style="color: #008080;">enum</span> <span style="color: #000000;">NEXT</span><span style="color: #0000FF;">,</span><span style="color: #000000;">PREV</span><span style="color: #0000FF;">,</span><span style="color: #000000;">DATA</span>
<span style="color: #008080;">constant</span> <span style="color: #000000;">empty_dll</span> <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">{{</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #000000;">1</span><span style="color: #0000FF;">}}</span>
Line 502:
<span style="color: #000000;">show</span><span style="color: #0000FF;">(</span><span style="color: #000000;">PREV</span><span style="color: #0000FF;">)</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">while</span>
<!--</
{{out}}
<pre>
Line 532:
=={{header|Wren}}==
{{libheader|Wren-llist}}
<
var dll = DLinkedList.new(["dog", "cat", "bear"])
Line 539:
System.print("After removal 1: %(dll)")
dll.removeAt(0) // remove by index
System.print("After removal 2: %(dll)")</
{{out}}
|