Singly-linked list/Element removal: Difference between revisions
Singly-linked list/Element removal (view source)
Revision as of 11:43, 6 February 2024
, 3 months ago→{{header|Wren}}: Minor tidy
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
m (→{{header|Wren}}: Minor tidy) |
||
(One intermediate revision by one other user not shown) | |||
Line 1,079:
After 2nd removal : 1
</pre>
=={{header|MiniScript}}==
We're choosing here to use the built-in list type, rather than make our own from scratch, since this is more representative of how one is likely to actually use MiniScript.
<syntaxhighlight lang="miniscript">
> myList = range(100, 110)
> myList
[100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110]
> myList.pop // removes the last element
110
> myList
[100, 101, 102, 103, 104, 105, 106, 107, 108, 109]
> myList.pull // removes the first element
100
> myList
[101, 102, 103, 104, 105, 106, 107, 108, 109]
> myList.remove 5 // removes 106 at index 5
> myList
[101, 102, 103, 104, 105, 107, 108, 109]
</syntaxhighlight>
=={{header|Nim}}==
Line 1,533 ⟶ 1,553:
=={{header|Wren}}==
{{libheader|Wren-llist}}
<syntaxhighlight lang="
var ll = LinkedList.new(["dog", "cat", "bear"])
|