summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/l3kernel/l3seq.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/l3kernel/l3seq.dtx')
-rw-r--r--macros/latex/contrib/l3kernel/l3seq.dtx77
1 files changed, 75 insertions, 2 deletions
diff --git a/macros/latex/contrib/l3kernel/l3seq.dtx b/macros/latex/contrib/l3kernel/l3seq.dtx
index 40d829f96c..bd935c6f60 100644
--- a/macros/latex/contrib/l3kernel/l3seq.dtx
+++ b/macros/latex/contrib/l3kernel/l3seq.dtx
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2020-06-18}
+% \date{Released 2020-07-17}
%
% \maketitle
%
@@ -139,7 +139,7 @@
% this space trimming behaviour is identical to that of
% \pkg{l3clist} functions. Empty \meta{items} are preserved by
% \cs{seq_set_split:Nnn}, and can be removed afterwards using
-% \cs{seq_remove_all:Nn} \meta{sequence} \Arg{}.
+% \cs{seq_remove_all:Nn} \meta{sequence} |{}|.
% The \meta{delimiter} may not contain |{|, |}| or |#|
% (assuming \TeX{}'s normal category code r\'egime).
% If the \meta{delimiter} is empty, the \meta{token list} is split
@@ -653,6 +653,40 @@
% \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}
+% \cs{seq_set_map_x: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 from \texttt{x}-expanding
+% \meta{inline function} applied to each \meta{item}
+% is assigned to \meta{sequence_1}. As such, the code
+% in \meta{inline function} should be expandable.
+% \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}[EXP, added = 2012-07-13]{\seq_count:N, \seq_count:c}
% \begin{syntax}
% \cs{seq_count:N} \meta{sequence}
@@ -2082,6 +2116,45 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\seq_set_map_x:NNn, \seq_gset_map_x:NNn}
+% \begin{macro}{\@@_set_map_x:NNNn}
+% Very similar to \cs{seq_set_filter:NNn}. We could actually
+% merge the two within a single function, but it would have weird
+% semantics.
+% \begin{macrocode}
+\cs_new_protected:Npn \seq_set_map_x:NNn
+ { \@@_set_map_x:NNNn \tl_set:Nx }
+\cs_new_protected:Npn \seq_gset_map_x:NNn
+ { \@@_set_map_x:NNNn \tl_gset:Nx }
+\cs_new_protected:Npn \@@_set_map_x: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_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_count:N, \seq_count:c}
% \begin{macro}{\@@_count:w, \@@_count_end:w}
% Since counting the items in a sequence is quite common, we optimize