On 11/10/2012 11:58 AM, Stephan Hennig wrote:
Am 09.11.2012 22:10, schrieb Hans Hagen:
On 11/9/2012 9:22 PM, Stephan Hennig wrote:
That is,
node.insert_after(nil, N, x)
is not a short-cut for inserting after N, but returns x as new head?
no, it returns n as head as well as x:
head, current = node.insert_after(nil,current,x)
boils down to
head = current
current = x
But this is in contrast to what the manual says.
| If head is initially nil, it will become new.
new == assigned
so:
head, current = node.insert_after(head,current,x)
becomes:
head = head or current or x
current = x
All valuable additions to the manual ...
it's not a 'how to mess with linked lists, more a reference manual -)
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------