Singly-linked list/Element definition: Difference between revisions
Singly-linked list/Element definition (view source)
Revision as of 01:40, 20 June 2023
, 11 months ago→{{header|jq}}: def insert($x):
m (BBC BASIC moved to the BASIC section.) |
(→{{header|jq}}: def insert($x):) |
||
Line 858:
else ($x.item) == ($y.item)
and equal_singly_linked_lists($x.next; $y.next)
end;
# insert $x into the front of the SLL
def insert($x):
if is_empty_singly_linked_list then {item: $x, next: null}
else .next |= new($x; .)
end;
</syntaxhighlight>
=={{header|Julia}}==
|