[latex3-commits] [git/LaTeX3-latex3-latex3] master: Add \tl_map_tokens:(N|n)n (411f5e7fd)

Joseph Wright joseph.wright at morningstar2.co.uk
Tue Sep 3 00:23:53 CEST 2019


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/411f5e7fd1d79be254ec8dc6859cf3c4f6c5fd3b

>---------------------------------------------------------------

commit 411f5e7fd1d79be254ec8dc6859cf3c4f6c5fd3b
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Mon Sep 2 23:23:53 2019 +0100

    Add \tl_map_tokens:(N|n)n


>---------------------------------------------------------------

411f5e7fd1d79be254ec8dc6859cf3c4f6c5fd3b
 l3kernel/CHANGELOG.md                   |  2 +-
 l3kernel/l3tl.dtx                       | 44 +++++++++++++++++++++++++++++++++
 l3kernel/testfiles/m3expl001.luatex.tlg |  4 +++
 l3kernel/testfiles/m3expl001.ptex.tlg   |  4 +++
 l3kernel/testfiles/m3expl001.tlg        |  4 +++
 l3kernel/testfiles/m3expl001.uptex.tlg  |  4 +++
 l3kernel/testfiles/m3expl001.xetex.tlg  |  4 +++
 l3kernel/testfiles/m3expl003.luatex.tlg |  4 +++
 l3kernel/testfiles/m3expl003.ptex.tlg   |  4 +++
 l3kernel/testfiles/m3expl003.tlg        |  4 +++
 l3kernel/testfiles/m3expl003.uptex.tlg  |  4 +++
 l3kernel/testfiles/m3expl003.xetex.tlg  |  4 +++
 12 files changed, 85 insertions(+), 1 deletion(-)

diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index 8c6bb0c9a..442d9f612 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -9,7 +9,7 @@ this project uses date-based 'snapshot' version identifiers.
 
 ### Added
 
-- `\seq_map_tokens:Nn`
+- `\seq_map_tokens:Nn`, `\tl_map_tokens:nn`, \tl_map_tokens:Nn`
 
 ### Changed
 
diff --git a/l3kernel/l3tl.dtx b/l3kernel/l3tl.dtx
index d38d17f2f..12fe907ef 100644
--- a/l3kernel/l3tl.dtx
+++ b/l3kernel/l3tl.dtx
@@ -551,6 +551,25 @@
 %   receives the \meta{item} as |#1|. See also \cs{tl_map_function:nN}.
 % \end{function}
 %
+% \begin{function}[rEXP, added = 2019-09-02]
+%   {\tl_map_tokens:Nn, \tl_map_tokens:cn, \tl_map_tokens:nn}
+%   \begin{syntax}
+%     \cs{tl_map_tokens:Nn} \meta{tl~var} \Arg{code}
+%     \cs{tl_map_tokens:nn} \meta{tokens} \Arg{code}
+%   \end{syntax}
+%   Analogue of \cs{tl_map_function:NN} which maps several tokens
+%   instead of a single function.  The \meta{code} receives each item in
+%   the \meta{tl~var} or \meta{tokens} as two trailing brace groups. For
+%   instance,
+%   \begin{verbatim}
+%     \tl_map_tokens:Nn \l_my_tl { \prg_replicate:nn { 2 } }
+%   \end{verbatim}
+%   expands to twice each item in the \meta{sequence}: for each item in
+%   |\l_my_tl| the function \cs{prg_replicate:nn} receives |2| and
+%   \meta{item} as its two arguments.  The function
+%   \cs{tl_map_inline:Nn} is typically faster but is not expandable.
+% \end{function}
+%
 % \begin{function}[updated = 2012-06-29]
 %   {\tl_map_variable:NNn, \tl_map_variable:cNn}
 %   \begin{syntax}
@@ -2408,6 +2427,31 @@
 % \end{macro}
 % \end{macro}
 %
+% \begin{macro}{\tl_map_tokens:nn}
+% \begin{macro}{\tl_map_tokens:Nn, \tl_map_tokens:cn}
+% \begin{macro}{\@@_map_tokens:nn}
+%   Much like the function mapping.
+%    \begin{macrocode}
+\cs_new:Npn \tl_map_tokens:nn #1#2
+  {
+    \@@_map_tokens:nn {#2} #1
+      \q_recursion_tail
+    \prg_break_point:Nn \tl_map_break: { }
+  }
+\cs_new:Npn \tl_map_tokens:Nn
+  { \exp_args:No \tl_map_tokens:nn }
+\cs_generate_variant:Nn \tl_map_tokens:Nn { c }
+\cs_new:Npn \@@_map_tokens:nn #1#2
+  {
+    \quark_if_recursion_tail_break:nN {#2} \tl_map_break:
+    \use:n {#1} {#2}
+    \@@_map_tokens:nn {#1}
+  }
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
 % \begin{macro}{\tl_map_variable:nNn}
 % \begin{macro}{\tl_map_variable:NNn, \tl_map_variable:cNn}
 % \begin{macro}{\@@_map_variable:Nnn}
diff --git a/l3kernel/testfiles/m3expl001.luatex.tlg b/l3kernel/testfiles/m3expl001.luatex.tlg
index 66f4ca912..3535857dc 100644
--- a/l3kernel/testfiles/m3expl001.luatex.tlg
+++ b/l3kernel/testfiles/m3expl001.luatex.tlg
@@ -533,6 +533,10 @@ Defining \tl_map_function:cN on line ...
 Defining \tl_map_inline:nn on line ...
 Defining \tl_map_inline:Nn on line ...
 Defining \tl_map_inline:cn on line ...
+Defining \tl_map_tokens:nn on line ...
+Defining \tl_map_tokens:Nn on line ...
+Defining \tl_map_tokens:cn on line ...
+Defining \__tl_map_tokens:nn on line ...
 Defining \tl_map_variable:nNn on line ...
 Defining \tl_map_variable:NNn on line ...
 Defining \__tl_map_variable:Nnn on line ...
diff --git a/l3kernel/testfiles/m3expl001.ptex.tlg b/l3kernel/testfiles/m3expl001.ptex.tlg
index 8a2ab7924..3a8fe469c 100644
--- a/l3kernel/testfiles/m3expl001.ptex.tlg
+++ b/l3kernel/testfiles/m3expl001.ptex.tlg
@@ -532,6 +532,10 @@ Defining \tl_map_function:cN on line ...
 Defining \tl_map_inline:nn on line ...
 Defining \tl_map_inline:Nn on line ...
 Defining \tl_map_inline:cn on line ...
+Defining \tl_map_tokens:nn on line ...
+Defining \tl_map_tokens:Nn on line ...
+Defining \tl_map_tokens:cn on line ...
+Defining \__tl_map_tokens:nn on line ...
 Defining \tl_map_variable:nNn on line ...
 Defining \tl_map_variable:NNn on line ...
 Defining \__tl_map_variable:Nnn on line ...
diff --git a/l3kernel/testfiles/m3expl001.tlg b/l3kernel/testfiles/m3expl001.tlg
index 210655630..5a44f8ece 100644
--- a/l3kernel/testfiles/m3expl001.tlg
+++ b/l3kernel/testfiles/m3expl001.tlg
@@ -532,6 +532,10 @@ Defining \tl_map_function:cN on line ...
 Defining \tl_map_inline:nn on line ...
 Defining \tl_map_inline:Nn on line ...
 Defining \tl_map_inline:cn on line ...
+Defining \tl_map_tokens:nn on line ...
+Defining \tl_map_tokens:Nn on line ...
+Defining \tl_map_tokens:cn on line ...
+Defining \__tl_map_tokens:nn on line ...
 Defining \tl_map_variable:nNn on line ...
 Defining \tl_map_variable:NNn on line ...
 Defining \__tl_map_variable:Nnn on line ...
diff --git a/l3kernel/testfiles/m3expl001.uptex.tlg b/l3kernel/testfiles/m3expl001.uptex.tlg
index ed19761f6..e5fd08a47 100644
--- a/l3kernel/testfiles/m3expl001.uptex.tlg
+++ b/l3kernel/testfiles/m3expl001.uptex.tlg
@@ -532,6 +532,10 @@ Defining \tl_map_function:cN on line ...
 Defining \tl_map_inline:nn on line ...
 Defining \tl_map_inline:Nn on line ...
 Defining \tl_map_inline:cn on line ...
+Defining \tl_map_tokens:nn on line ...
+Defining \tl_map_tokens:Nn on line ...
+Defining \tl_map_tokens:cn on line ...
+Defining \__tl_map_tokens:nn on line ...
 Defining \tl_map_variable:nNn on line ...
 Defining \tl_map_variable:NNn on line ...
 Defining \__tl_map_variable:Nnn on line ...
diff --git a/l3kernel/testfiles/m3expl001.xetex.tlg b/l3kernel/testfiles/m3expl001.xetex.tlg
index c8f1026c7..53efc5f87 100644
--- a/l3kernel/testfiles/m3expl001.xetex.tlg
+++ b/l3kernel/testfiles/m3expl001.xetex.tlg
@@ -532,6 +532,10 @@ Defining \tl_map_function:cN on line ...
 Defining \tl_map_inline:nn on line ...
 Defining \tl_map_inline:Nn on line ...
 Defining \tl_map_inline:cn on line ...
+Defining \tl_map_tokens:nn on line ...
+Defining \tl_map_tokens:Nn on line ...
+Defining \tl_map_tokens:cn on line ...
+Defining \__tl_map_tokens:nn on line ...
 Defining \tl_map_variable:nNn on line ...
 Defining \tl_map_variable:NNn on line ...
 Defining \__tl_map_variable:Nnn on line ...
diff --git a/l3kernel/testfiles/m3expl003.luatex.tlg b/l3kernel/testfiles/m3expl003.luatex.tlg
index 66f4ca912..3535857dc 100644
--- a/l3kernel/testfiles/m3expl003.luatex.tlg
+++ b/l3kernel/testfiles/m3expl003.luatex.tlg
@@ -533,6 +533,10 @@ Defining \tl_map_function:cN on line ...
 Defining \tl_map_inline:nn on line ...
 Defining \tl_map_inline:Nn on line ...
 Defining \tl_map_inline:cn on line ...
+Defining \tl_map_tokens:nn on line ...
+Defining \tl_map_tokens:Nn on line ...
+Defining \tl_map_tokens:cn on line ...
+Defining \__tl_map_tokens:nn on line ...
 Defining \tl_map_variable:nNn on line ...
 Defining \tl_map_variable:NNn on line ...
 Defining \__tl_map_variable:Nnn on line ...
diff --git a/l3kernel/testfiles/m3expl003.ptex.tlg b/l3kernel/testfiles/m3expl003.ptex.tlg
index 8a2ab7924..3a8fe469c 100644
--- a/l3kernel/testfiles/m3expl003.ptex.tlg
+++ b/l3kernel/testfiles/m3expl003.ptex.tlg
@@ -532,6 +532,10 @@ Defining \tl_map_function:cN on line ...
 Defining \tl_map_inline:nn on line ...
 Defining \tl_map_inline:Nn on line ...
 Defining \tl_map_inline:cn on line ...
+Defining \tl_map_tokens:nn on line ...
+Defining \tl_map_tokens:Nn on line ...
+Defining \tl_map_tokens:cn on line ...
+Defining \__tl_map_tokens:nn on line ...
 Defining \tl_map_variable:nNn on line ...
 Defining \tl_map_variable:NNn on line ...
 Defining \__tl_map_variable:Nnn on line ...
diff --git a/l3kernel/testfiles/m3expl003.tlg b/l3kernel/testfiles/m3expl003.tlg
index 210655630..5a44f8ece 100644
--- a/l3kernel/testfiles/m3expl003.tlg
+++ b/l3kernel/testfiles/m3expl003.tlg
@@ -532,6 +532,10 @@ Defining \tl_map_function:cN on line ...
 Defining \tl_map_inline:nn on line ...
 Defining \tl_map_inline:Nn on line ...
 Defining \tl_map_inline:cn on line ...
+Defining \tl_map_tokens:nn on line ...
+Defining \tl_map_tokens:Nn on line ...
+Defining \tl_map_tokens:cn on line ...
+Defining \__tl_map_tokens:nn on line ...
 Defining \tl_map_variable:nNn on line ...
 Defining \tl_map_variable:NNn on line ...
 Defining \__tl_map_variable:Nnn on line ...
diff --git a/l3kernel/testfiles/m3expl003.uptex.tlg b/l3kernel/testfiles/m3expl003.uptex.tlg
index ed19761f6..e5fd08a47 100644
--- a/l3kernel/testfiles/m3expl003.uptex.tlg
+++ b/l3kernel/testfiles/m3expl003.uptex.tlg
@@ -532,6 +532,10 @@ Defining \tl_map_function:cN on line ...
 Defining \tl_map_inline:nn on line ...
 Defining \tl_map_inline:Nn on line ...
 Defining \tl_map_inline:cn on line ...
+Defining \tl_map_tokens:nn on line ...
+Defining \tl_map_tokens:Nn on line ...
+Defining \tl_map_tokens:cn on line ...
+Defining \__tl_map_tokens:nn on line ...
 Defining \tl_map_variable:nNn on line ...
 Defining \tl_map_variable:NNn on line ...
 Defining \__tl_map_variable:Nnn on line ...
diff --git a/l3kernel/testfiles/m3expl003.xetex.tlg b/l3kernel/testfiles/m3expl003.xetex.tlg
index c8f1026c7..53efc5f87 100644
--- a/l3kernel/testfiles/m3expl003.xetex.tlg
+++ b/l3kernel/testfiles/m3expl003.xetex.tlg
@@ -532,6 +532,10 @@ Defining \tl_map_function:cN on line ...
 Defining \tl_map_inline:nn on line ...
 Defining \tl_map_inline:Nn on line ...
 Defining \tl_map_inline:cn on line ...
+Defining \tl_map_tokens:nn on line ...
+Defining \tl_map_tokens:Nn on line ...
+Defining \tl_map_tokens:cn on line ...
+Defining \__tl_map_tokens:nn on line ...
 Defining \tl_map_variable:nNn on line ...
 Defining \tl_map_variable:NNn on line ...
 Defining \__tl_map_variable:Nnn on line ...





More information about the latex3-commits mailing list