On 5/9/2025 5:41 AM, Pablo Rodriguez via ntg-context wrote:
On 5/8/25 21:02, Hans Hagen via ntg-context wrote:
[...]
These % after the comparison make tex scan on for the end of a number (a
\relax of space ends the scan). You can do this:

Many thanks for your reply, Hans.

With your sample, I see that some crazy things (such as the following)
are possible:

   \starttext
   \dorecurse{2}{%
     \dorecurse{3}{%
       \dorecurse{4}{%
         \dorecurse{5}{%
           \dorecurse{6}{%
             #1:##1:####1:########1:################1 }\\
   }\blank[.25st]}\blank[.5st]}\blank[1st]}
   \stoptext

I mean, accessing different levels of recursion in nested loops.

Being a very special trick for really corner cases, is there something
to be considered when using it?

only imagination ... try #2 ##2 etc .. these #1 things are basically references to macro arguments

\dorecurse{1}{%
    \dorecurse{3}{%
        \dorecurse{3}{%
            \dorecurse{3}{%
                \dorecurse{3}{%
                  % #1:##1:####1:########1:################1
                    #2:##2:####2:########2:################2
                }\\
            }
            \blank[.25st]
        }
        \blank[.5st]
    }
    \blank[1st]
}

\page

or go wild with

\localcontrolledrepeat 1 {
    \localcontrolledrepeat 3 {
        \localcontrolledrepeat 3 {
            \localcontrolledrepeat 3 {
                \localcontrolledrepeat 3 {
                    \the\previousloopiterator4:%
                    \the\previousloopiterator3:%
                    \the\previousloopiterator2:%
                    \the\previousloopiterator1:%
                    \the\previousloopiterator0 %
                }\\
            }
            \blank[.25st]
        }
        \blank[.5st]
    }
    \blank[1st]
}

\page

or maybe:

\edef\foo{%
\expandedrepeat 1 {
    \expandedrepeat 3 {
        \expandedrepeat 3 {
            \expandedrepeat 3 {
                \expandedrepeat 3 {
                    \the\previousloopiterator4:%
                    \the\previousloopiterator3:%
                    \the\previousloopiterator2:%
                    \the\previousloopiterator1:%
                    \the\previousloopiterator0 %
                }\\
            }
            \blank[.25st]
        }
        \blank[.5st]
    }
    \blank[1st]
}
}

\foo

\meaningfull\foo

enough in there for a rainy day

Hans

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to