Print

Print


Sorry Lars,

I got your surname completely wrong in my previous email. (not sure
why that happened)


>> a constructed function name ie "c" though that is something you would
>> seldom need I guess.
>
> And it would be covered by applying a suitable \exp_args:... to the
> ..._map_function:... call, would it not?

The simplest would be
\cs_set_eq:NN \..._map_function:NN \..._map_function:Nn
\cs_generate_variant:Nn \..._map_function:NN {Nc}


>    ...map_function:Nn \l_foo_seq { \func:nn{foo} }
>
> rather do
>
>    \cs_new:Npn \map_func:n #1 { \func:nn{foo}{#1} }
>
>    ...map_function:NN \l_foo_seq \map_func:n
>
> ? The downside of this is that it hardwires the "foo" into a function
> body, when in practice it might be data that changes from call to call.
> You can of course redefine \map_func:n before every use, but it feels
> unelegant.

In the current implementation, if expandability is not an issue,
prefer map_inline, as it does not require any test for termination.

\seq_map_inline:Nn \l_foo_seq { \func:nn {foo} {#1} }

But if you need expandability, then map_function is required.

>    \cs_new:Npn \exch_args:Nnnn #1 #2 #3 #4 { #1{#2}{#4}{#3} }

I'd personally call it \use_i_bii_biv_biii:nnnn, where "b" means
"braced". This is more extensible, and fits with the current
\use_i_ii:nnn.

> but \exch_args:Nnnn is more elegant, since it can be reused in more places.

Regards,
-- Bruno