Doubly-linked list/Element definition: Difference between revisions
Content added Content deleted
(Added Wren) |
|||
Line 1,002: | Line 1,002: | ||
Public Previous As Node(Of T) |
Public Previous As Node(Of T) |
||
End Class</lang> |
End Class</lang> |
||
=={{header|Wren}}== |
|||
{{libheader|Wren-llist}} |
|||
The DLinkedList class in the above module is a generic doubly-linked list and is implemented in such a way that circular loops are not possible. We therefore use it here. |
|||
<lang ecmascript>import "/llist" for DLinkedList |
|||
var dll = DLinkedList.new() |
|||
for (i in 1..3) dll.add(i) |
|||
System.print(dll) |
|||
for (i in 1..3) dll.remove(i) |
|||
System.print(dll)</lang> |
|||
{{out}} |
|||
<pre> |
|||
[1 <-> 2 <-> 3] |
|||
[] |
|||
</pre> |
|||
=={{header|zkl}}== |
=={{header|zkl}}== |