[luatex] Behavior of node lists.

Stephan Hennig mailing_list at arcor.de
Sat Nov 10 19:22:24 CET 2012


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.

To translate that to our example

  If x is nil, then a becomes z.

Where's my error?


>>>     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?

Best regards,
Stephan Hennig



More information about the luatex mailing list