[latex3-commits] [latex3/latex3] main: Revert "Remove \seq_set_from_function:NnN and \seq_set_from_inline_x:Nnn" (da9a79962)
github at latex-project.org
github at latex-project.org
Fri May 5 12:56:09 CEST 2023
Repository : https://github.com/latex3/latex3
On branch : main
Link : https://github.com/latex3/latex3/commit/da9a79962853f79a41847b2f72d881a227edc2a9
>---------------------------------------------------------------
commit da9a79962853f79a41847b2f72d881a227edc2a9
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Fri May 5 11:51:16 2023 +0100
Revert "Remove \seq_set_from_function:NnN and \seq_set_from_inline_x:Nnn"
This reverts commit 29ff12e491230976c742fa258c1562037628e44a.
>---------------------------------------------------------------
da9a79962853f79a41847b2f72d881a227edc2a9
l3kernel/l3candidates.dtx | 67 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 67 insertions(+)
diff --git a/l3kernel/l3candidates.dtx b/l3kernel/l3candidates.dtx
index 89104ae32..f5712cfd2 100644
--- a/l3kernel/l3candidates.dtx
+++ b/l3kernel/l3candidates.dtx
@@ -119,6 +119,44 @@
% \end{texnote}
% \end{function}
%
+% \begin{function}[added = 2018-04-06]
+% {\seq_set_from_function:NnN, \seq_gset_from_function:NnN}
+% \begin{syntax}
+% \cs{seq_set_from_function:NnN} \meta{seq~var} \Arg{loop~code} \meta{function}
+% \end{syntax}
+% Sets the \meta{seq~var} equal to a sequence whose items are obtained
+% by \texttt{x}-expanding \meta{loop~code} \meta{function}. This
+% expansion must result in successive calls to the \meta{function}
+% with no nonexpandable tokens in between. More precisely the
+% \meta{function} is replaced by a wrapper function that inserts the
+% appropriate separators between items in the sequence. The
+% \meta{loop~code} must be expandable; it can be for example
+% \cs{tl_map_function:NN} \meta{tl~var} or \cs{clist_map_function:nN}
+% \Arg{clist} or \cs{int_step_function:nnnN} \Arg{initial value}
+% \Arg{step} \Arg{final value}.
+% \end{function}
+%
+% \begin{function}[added = 2018-04-06]
+% {\seq_set_from_inline_x:Nnn, \seq_gset_from_inline_x:Nnn}
+% \begin{syntax}
+% \cs{seq_set_from_inline_x:Nnn} \meta{seq~var} \Arg{loop~code} \Arg{inline~code}
+% \end{syntax}
+% Sets the \meta{seq~var} equal to a sequence whose items are obtained
+% by \texttt{x}-expanding \meta{loop~code} applied to a
+% \meta{function} derived from the \meta{inline~code}. A
+% \meta{function} is defined, that takes one argument,
+% \texttt{x}-expands the \meta{inline~code} with that argument
+% as~|#1|, then adds appropriate separators to turn the result into an
+% item of the sequence. The \texttt{x}-expansion of \meta{loop~code}
+% \meta{function} must result in successive calls to the
+% \meta{function} with no nonexpandable tokens in between. The
+% \meta{loop~code} must be expandable; it can be for example
+% \cs{tl_map_function:NN} \meta{tl~var} or \cs{clist_map_function:nN}
+% \Arg{clist} or \cs{int_step_function:nnnN} \Arg{initial value}
+% \Arg{step} \Arg{final value}, but not the analogous \enquote{inline}
+% mappings.
+% \end{function}
+%
% \begin{function}[added = 2021-04-29, noTF]
% {\seq_set_item:Nnn, \seq_set_item:cnn, \seq_gset_item:Nnn, \seq_gset_item:cnn}
% \begin{syntax}
@@ -312,6 +350,35 @@
% \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.
+% \begin{macrocode}
+\cs_new_protected:Npn \seq_set_from_inline_x:Nnn
+ { \@@_set_from_inline_x:NNnn \__kernel_tl_set:Nx }
+\cs_new_protected:Npn \seq_gset_from_inline_x:Nnn
+ { \@@_set_from_inline_x:NNnn \__kernel_tl_gset:Nx }
+\cs_new_protected:Npn \@@_set_from_inline_x:NNnn #1#2#3#4
+ {
+ \@@_push_item_def:n { \exp_not:N \@@_item:n {#4} }
+ #1 #2 { \s_@@ #3 \@@_item:n }
+ \@@_pop_item_def:
+ }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\seq_set_from_function:NnN, \seq_gset_from_function:NnN}
+% Reuse \cs{seq_set_from_inline_x:Nnn}.
+% \begin{macrocode}
+\cs_new_protected:Npn \seq_set_from_function:NnN #1#2#3
+ { \seq_set_from_inline_x:Nnn #1 {#2} { #3 {##1} } }
+\cs_new_protected:Npn \seq_gset_from_function:NnN #1#2#3
+ { \seq_gset_from_inline_x:Nnn #1 {#2} { #3 {##1} } }
+% \end{macrocode}
+% \end{macro}
+%
+%
% \begin{macro}{\@@_int_eval:w}
% Useful to more quickly go through items.
% \begin{macrocode}
More information about the latex3-commits
mailing list.