Timeline for Does a package exist for programmatically (incrementally) constructing a macro?
Current License: CC BY-SA 4.0
11 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Aug 25, 2022 at 22:25 | comment | added | jps |
But you need the e-expansion anyways for the brace tricks and to get the \addunexpanded working correctly (because you can't x-expand this without having to double #s in its argument).
|
|
| Aug 25, 2022 at 22:20 | comment | added | egreg | @Skillmon I'd prefer to have the expansion at execution time, not at the end of the job. | |
| Aug 25, 2022 at 22:14 | comment | added | jps |
@egreg for your \addexpanded I'd suggest to use \tl_put_right:Nn \l__coto_macro_body_tl {#1} instead (this way the argument is expanded by \expanded instead of in an \edef and one can use a single macro parameter token instead of having to double them). Also \addcsname could be simplified using \tl_put_right:Nn as well.
|
|
| Aug 25, 2022 at 7:28 | comment | added | egreg | @JosephWright Yes, but it wouldn't be really very different. Possibly a bit more efficient. Anyway, since I can't recommend doing the job like this… | |
| Aug 25, 2022 at 7:23 | comment | added | Joseph Wright♦ |
Did you consider using \tl_build?
|
|
| Aug 25, 2022 at 7:14 | comment | added | egreg |
@COTO No, it wasn't. I also changed \addparameter, since I find it strange to add # and then 1: they're a single unit, when thinking about macros.
|
|
| Aug 25, 2022 at 7:14 | history | edited | egreg | CC BY-SA 4.0 |
removed wrong bit
|
| Aug 25, 2022 at 6:25 | comment | added | jps |
@COTO yes, it is, since the assignment done is \tl_put_right:Nx instead of \tl_put_right:Nn, the x means that it is fully expanded there. The effect is the same as using \tl_put_right:Nn \l__coto_macro_body_tl {#1} (and I'd personally prefer the latter for clarity, same goes for \addcsname, there I'd personally prefer \tl_put_right:Nn \l__coto_macro_body_tl { \exp_not:c {#1} } -- but it really makes no difference so both is fine and just a matter of taste).
|
|
| Aug 24, 2022 at 23:30 | comment | added | COTO |
Is the \exp_not:n in \addexpanded supposed to be there?
|
|
| Aug 24, 2022 at 23:12 | vote | accept | COTO | ||
| Aug 24, 2022 at 21:44 | history | answered | egreg | CC BY-SA 4.0 |