[latex3-commits] [git/LaTeX3-latex3-latex3] seq_set_map: Add non-x-expanding \seq_set_map:NNn (also fixes #766) (a04215183)
PhelypeOleinik
tex.phelype at gmail.com
Thu Jul 16 15:10:50 CEST 2020
Repository : https://github.com/latex3/latex3
On branch : seq_set_map
Link : https://github.com/latex3/latex3/commit/a04215183400f1234e048c9542fe769c3112144d
>---------------------------------------------------------------
commit a04215183400f1234e048c9542fe769c3112144d
Author: PhelypeOleinik <tex.phelype at gmail.com>
Date: Thu Jul 16 10:10:50 2020 -0300
Add non-x-expanding \seq_set_map:NNn (also fixes #766)
>---------------------------------------------------------------
a04215183400f1234e048c9542fe769c3112144d
l3kernel/l3candidates.dtx | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/l3kernel/l3candidates.dtx b/l3kernel/l3candidates.dtx
index 80d442b56..8ff62e161 100644
--- a/l3kernel/l3candidates.dtx
+++ b/l3kernel/l3candidates.dtx
@@ -426,6 +426,22 @@
% \end{texnote}
% \end{function}
%
+% \begin{function}[added = 2011-12-22, updated = 2020-07-16]
+% {\seq_set_map:NNn, \seq_gset_map:NNn}
+% \begin{syntax}
+% \cs{seq_set_map:NNn} \meta{sequence_1} \meta{sequence_2} \Arg{inline function}
+% \end{syntax}
+% Applies \meta{inline function} to every \meta{item} stored
+% within the \meta{sequence_2}. The \meta{inline function} should
+% consist of code which will receive the \meta{item} as |#1|.
+% The sequence resulting applying \meta{inline function} to each
+% \meta{item} is assigned to \meta{sequence_1}.
+% \begin{texnote}
+% Contrarily to other mapping functions, \cs{seq_map_break:} cannot
+% be used in this function, and would lead to low-level \TeX{} errors.
+% \end{texnote}
+% \end{function}
+%
% \begin{function}[added = 2020-07-16]
% {\seq_set_map_x:NNn, \seq_gset_map_x:NNn}
% \begin{syntax}
@@ -1165,6 +1181,25 @@
% \end{macro}
% \end{macro}
%
+% \begin{macro}{\seq_set_map:NNn, \seq_gset_map:NNn}
+% \begin{macro}{\@@_set_map:NNNn}
+% Similar to \cs{seq_set_map_x:NNn}, but prevents expansion of the
+% <inline function>.
+% \begin{macrocode}
+\cs_new_protected:Npn \seq_set_map:NNn
+ { \@@_set_map:NNNn \tl_set:Nx }
+\cs_new_protected:Npn \seq_gset_map:NNn
+ { \@@_set_map:NNNn \tl_gset:Nx }
+\cs_new_protected:Npn \@@_set_map:NNNn #1#2#3#4
+ {
+ \@@_push_item_def:n { \exp_not:n { \@@_item:n {#4} } }
+ #1 #2 { #3 }
+ \@@_pop_item_def:
+ }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
% \begin{macro}{\seq_set_from_inline_x:Nnn, \seq_gset_from_inline_x:Nnn}
% \begin{macro}{\@@_set_from_inline_x:NNnn}
% Set \cs{@@_item:n} then map it using the loop code.
More information about the latex3-commits
mailing list.