Singly-linked list/Element definition: Difference between revisions

→‎{{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;</syntaxhighlight>
 
# 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}}==
2,447

edits