Suppose you have a function that operates on three tokens,
\cs_new:Nn \@@_on_three:NNN { #1, #2, #3 }
And you have a variable whose value is the three tokens:
\tl_set:Nn \l@@_three_tl { foo }
And you would like to have a variant
\@@_on_three:V
so that you can say
\@@_on_three:V \l@@_three_tl
However, if I'm not mistaken, a direct \cs_generate_variant
would be confused by the different number of arguments (NNN
vs. V
or x
), and in any case it will pass the expanded argument within braces, right?
So what you need is a kind of 'fake' variant, defined as:
\cs_new:Nn \@@_on_three:V
{ \exp_last_unbraced:Nx \@@_on_three:NNN #1 }
To be clear: this works. My question is rather whether there was another way to do this that is less 'naughty'---less mid-level tricking of expl3
.