On 11/8/2012 10:21 PM, Stephan Hennig wrote:
That is, the first argument <head> is actually never needed. Though, on
maybe in your code, but in mine it's needed in most cases
the former line, you can't easily tell what happens, just from the
arguments. You need to know about the current == nil case. And I
guess, insert_after calls node.tail(head) behind the scenes anyway when
current == nil. The current function insert_after is making things more
complicated than necessary, I think. Am I missing something?
that there are all kind of usage
indeed reordering in no option
(we could consider a two argument variant i.e. if two arguments, then
assume N, x)
At the cost of an additional argument check. Undesirable as well ...
depends ... just a nil check in c ... but anyhow, you write a wrapper:
you can consider wrapping it in a helper:
function i_a(n,current,head)
return node.insert_after(head,current,n)
end
the overhead is neglectable
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
-----------------------------------------------------------------