Singly-linked list/Element insertion: Difference between revisions

→‎{{header|Perl 6}}: comply with the task description
(→‎{{header|Perl 6}}: comply with the task description)
Line 1,132:
insert_after $list2->{next}, { data => 'A2a' }, { data => 'A2b' };</lang>
=={{header|Perl 6}}==
 
{{incorrect|Perl 6|This is an array, not a singly linked list. It isn't even attempting to emulate a singly linked list.}}
Extending <tt>class Cell</tt> from [[Singly-linked_list/Element_definition#Perl_6]]:
<lang perl6>my @list = <a b>;
 
say @list.splice(1,0,'c');
<lang perl6> method insert ($value) {
say @list;</lang>
$.next = Cell.new(:$value, :$.next)
say @list; }</lang>
 
=={{header|Phix}}==
Anonymous user