[NTG-context] serial definition

Hans Hagen pragma at wxs.nl
Tue Jan 3 18:22:50 CET 2006


Taco Hoekwater wrote:

>
>
> Peter Rolf wrote:
>
>>>
>>> Why do I get K0/V0 for \Get{3}? - it works with \recurselevel!
>>>
>
> You need to expand the \Set commands in that first loop,
> otherwise you store the literal token \recursevelel inside
> the definitions of the Key and Val macros (\setvalue{}{}
> autoexpands its first argument, but not its second argument).
>
> When not inside a recursion, \recurselevel expands to the number
> 0  (zero) in the "manual bit", and you are actually re-evaluating
> the macro using the then current \recurselevel definition
> when inside the  "looping" bit.
>
> So you need:
>
>   \dostepwiserecurse{1}{9}{1}{
>     \expanded{\Set{\recurselevel}{K\recurselevel}{V\recurselevel}}
>   }
>
> I hope this is clear enough?

even this works (#1 being the expanded \recurselevel):

\dostepwiserecurse{1}{9}{1}{
  \setvalue{hi there #1}{#1 indeed}
}

\getvalue{hi there 4}



More information about the ntg-context mailing list