[luatex] Behavior of node lists.
Paul Isambert
zappathustra at free.fr
Sat Nov 10 21:03:48 CET 2012
Selon Stephan Hennig <mailing_list at arcor.de>:
> Am 10.11.2012 12:29, schrieb Hans Hagen:
> > 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
>
> Or 42? I still think there's a contradiction. Let's go with abstract
> variable names. Assuming a function
>
> a, b = f(x,y,z)
>
> Now, I interpret what you said above as
>
> If x is nil (see above) then a becomes y.
>
> Whereas the LuaTeX manual says
>
> | If head is initially nil, it will become new.
It's an error in the manual; it makes little sense anyway for "new" to be the
head if you insert AFTER "current" (the description is valid for
"node.insert_before").
> >>> 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, do you think a function signature is enough documentation? What's
> in a name?
If you rely on the manual to work with LuaTeX, you'll learn mostly by
experimentation anyway; I've never found the descriptions there confusing
(notwithstanding some errors), though sometimes not very enlightening either,
but I've never expected them to be so. There still room for a "LuaTeX User's
Guide", to be written by anybody.
Best,
Paul
More information about the luatex
mailing list