[latex3-commits] [git/LaTeX3-latex3-latex3] gh900: Add new map functions directly to stable (b9bf7746d)
Joseph Wright
joseph.wright at morningstar2.co.uk
Wed May 5 10:27:41 CEST 2021
Repository : https://github.com/latex3/latex3
On branch : gh900
Link : https://github.com/latex3/latex3/commit/b9bf7746d709301c1e872a7dee6a5ceee2e888cf
>---------------------------------------------------------------
commit b9bf7746d709301c1e872a7dee6a5ceee2e888cf
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Wed May 5 09:27:41 2021 +0100
Add new map functions directly to stable
>---------------------------------------------------------------
b9bf7746d709301c1e872a7dee6a5ceee2e888cf
l3kernel/l3candidates.dtx | 100 ----------------------------------------------
l3kernel/l3clist.dtx | 53 ++++++++++++++++++++++++
l3kernel/l3str.dtx | 31 ++++++++++++++
3 files changed, 84 insertions(+), 100 deletions(-)
diff --git a/l3kernel/l3candidates.dtx b/l3kernel/l3candidates.dtx
index ed740165a..6cfb0d745 100644
--- a/l3kernel/l3candidates.dtx
+++ b/l3kernel/l3candidates.dtx
@@ -146,20 +146,6 @@
% operation is applied.
% \end{function}
%
-% \section{Additions to \pkg{l3clist}}
-%
-% \begin{function}[rEXP, added = 2021-05-05]
-% {\clist_map_tokens:Nn, \clist_map_tokens:cn, \clist_map_tokens:nn}
-% \begin{syntax}
-% \cs{clist_map_tokens:Nn} \meta{clist~var} \Arg{code}
-% \cs{clist_map_tokens:nn} \Arg{comma list} \Arg{code}
-% \end{syntax}
-% Calls \meta{code} \Arg{item} for every \meta{item} stored in the
-% \meta{comma list}. The \meta{code} receives each \meta{item} as a
-% trailing brace group. If the \meta{code} consists of a single
-% function this is equivalent to \cs{clist_map_function:nN}.
-% \end{function}
-%
% \section{Additions to \pkg{l3expan}}
%
% \begin{function}[added = 2018-04-04, updated = 2019-02-08]
@@ -484,21 +470,6 @@
% assigned locally for |pop| or globally for |gpop| functions.
% \end{function}
%
-% \section{Additions to \pkg{l3str}}
-%
-% \begin{function}[rEXP, added = 2021-05-05]
-% {\str_map_tokens:nn, \str_map_tokens:Nn, \str_map_tokens:cn}
-% \begin{syntax}
-% \cs{str_map_tokens:nn} \Arg{token list} \Arg{code}
-% \cs{str_map_tokens:Nn} \meta{str~var} \Arg{code}
-% \end{syntax}
-% Converts the \meta{token list} to a \meta{string} then applies
-% \meta{code} to every \meta{character} in the \meta{string} including
-% spaces. The \meta{code} receives each character as a trailing brace
-% group. This is equivalent to \cs{str_map_function:nN} if the
-% \meta{code} consists of a single function.
-% \end{function}
-%
% \section{Additions to \pkg{l3sys}}
%
% \begin{variable}[added = 2018-05-02]{\c_sys_engine_version_str}
@@ -890,53 +861,6 @@
% \end{macro}
% \end{macro}
%
-% \subsection{Additions to \pkg{l3clist}}
-%
-% \begin{macrocode}
-%<@@=clist>
-% \end{macrocode}
-%
-% \begin{macro}{\clist_map_tokens:Nn, \clist_map_tokens:cn}
-% \begin{macro}{\@@_map_tokens:nw}
-% Essentially a copy of \cs{clist_map_function:NN} with braces added.
-% \begin{macrocode}
-\cs_new:Npn \clist_map_tokens:Nn #1#2
- {
- \clist_if_empty:NF #1
- {
- \exp_last_unbraced:Nno \@@_map_function:nw {#2} #1
- , \q_@@_recursion_tail ,
- \prg_break_point:Nn \clist_map_break: { }
- }
- }
-\cs_generate_variant:Nn \clist_map_tokens:Nn { c }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\clist_map_tokens:nn, \@@_map_tokens_n:nw}
-% Similar to \cs{clist_map_function:nN} but with a different way of
-% grabbing items because we cannot use \cs{exp_after:wN} to pass the
-% \meta{code}.
-% \begin{macrocode}
-\cs_new:Npn \clist_map_tokens:nn #1#2
- {
- \@@_map_tokens_n:nw {#2}
- \prg_do_nothing: #1 , \q_@@_recursion_tail ,
- \prg_break_point:Nn \clist_map_break: { }
- }
-\cs_new:Npn \@@_map_tokens_n:nw #1#2 ,
- {
- \tl_if_empty:oF { \use_none:nn #2 ? }
- {
- \exp_args:No \@@_if_recursion_tail_break:nN {#2} \clist_map_break:
- \tl_trim_spaces_apply:oN {#2} \@@_map_unbrace:wn , {#1}
- }
- \@@_map_tokens_n:nw {#1} \prg_do_nothing:
- }
-% \end{macrocode}
-% \end{macro}
-%
% \subsection{Additions to \pkg{l3flag}}
%
% \begin{macrocode}
@@ -1409,30 +1333,6 @@
% \end{macro}
% \end{macro}
%
-% \subsection{Additions to \pkg{l3str}}
-%
-% \begin{macrocode}
-%<@@=str>
-% \end{macrocode}
-%
-% \begin{macro}[rEXP]{\str_map_tokens:Nn, \str_map_tokens:cn}
-% \begin{macro}[rEXP]{\str_map_tokens:nn}
-% Uses an auxiliary of \cs{str_map_function:NN}.
-% \begin{macrocode}
-\cs_new:Npn \str_map_tokens:nn #1#2
- {
- \exp_args:Nno \use:nn
- { \@@_map_function:w \@@_map_function:nn {#2} }
- { \__kernel_tl_to_str:w {#1} }
- \q_@@_recursion_tail ? ~
- \prg_break_point:Nn \str_map_break: { }
- }
-\cs_new:Npn \str_map_tokens:Nn { \exp_args:No \str_map_tokens:nn }
-\cs_generate_variant:Nn \str_map_tokens:Nn { c }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
% \subsection{Additions to \pkg{l3sys}}
%
% \begin{macrocode}
diff --git a/l3kernel/l3clist.dtx b/l3kernel/l3clist.dtx
index b9ccfabc7..1f0dc5e73 100644
--- a/l3kernel/l3clist.dtx
+++ b/l3kernel/l3clist.dtx
@@ -455,6 +455,18 @@
% \meta{items} are returned from left to right.
% \end{function}
%
+% \begin{function}[rEXP, added = 2021-05-05]
+% {\clist_map_tokens:Nn, \clist_map_tokens:cn, \clist_map_tokens:nn}
+% \begin{syntax}
+% \cs{clist_map_tokens:Nn} \meta{clist~var} \Arg{code}
+% \cs{clist_map_tokens:nn} \Arg{comma list} \Arg{code}
+% \end{syntax}
+% Calls \meta{code} \Arg{item} for every \meta{item} stored in the
+% \meta{comma list}. The \meta{code} receives each \meta{item} as a
+% trailing brace group. If the \meta{code} consists of a single
+% function this is equivalent to \cs{clist_map_function:nN}.
+% \end{function}
+%
% \begin{function}[rEXP, updated = 2012-06-29]{\clist_map_break:}
% \begin{syntax}
% \cs{clist_map_break:}
@@ -1768,6 +1780,47 @@
% \end{macro}
% \end{macro}
%
+% \begin{macro}{\clist_map_tokens:Nn, \clist_map_tokens:cn}
+% \begin{macro}{\@@_map_tokens:nw}
+% Essentially a copy of \cs{clist_map_function:NN} with braces added.
+% \begin{macrocode}
+\cs_new:Npn \clist_map_tokens:Nn #1#2
+ {
+ \clist_if_empty:NF #1
+ {
+ \exp_last_unbraced:Nno \@@_map_function:nw {#2} #1
+ , \q_@@_recursion_tail ,
+ \prg_break_point:Nn \clist_map_break: { }
+ }
+ }
+\cs_generate_variant:Nn \clist_map_tokens:Nn { c }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\clist_map_tokens:nn, \@@_map_tokens_n:nw}
+% Similar to \cs{clist_map_function:nN} but with a different way of
+% grabbing items because we cannot use \cs{exp_after:wN} to pass the
+% \meta{code}.
+% \begin{macrocode}
+\cs_new:Npn \clist_map_tokens:nn #1#2
+ {
+ \@@_map_tokens_n:nw {#2}
+ \prg_do_nothing: #1 , \q_@@_recursion_tail ,
+ \prg_break_point:Nn \clist_map_break: { }
+ }
+\cs_new:Npn \@@_map_tokens_n:nw #1#2 ,
+ {
+ \tl_if_empty:oF { \use_none:nn #2 ? }
+ {
+ \exp_args:No \@@_if_recursion_tail_break:nN {#2} \clist_map_break:
+ \tl_trim_spaces_apply:oN {#2} \@@_map_unbrace:wn , {#1}
+ }
+ \@@_map_tokens_n:nw {#1} \prg_do_nothing:
+ }
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\clist_map_break:, \clist_map_break:n}
% The break statements use the general \cs{prg_map_break:Nn} mechanism.
% \begin{macrocode}
diff --git a/l3kernel/l3str.dtx b/l3kernel/l3str.dtx
index 290b6a083..50f765cc1 100644
--- a/l3kernel/l3str.dtx
+++ b/l3kernel/l3str.dtx
@@ -447,6 +447,19 @@
% \meta{string} is empty. See also \cs{str_map_inline:Nn}.
% \end{function}
%
+% \begin{function}[rEXP, added = 2021-05-05]
+% {\str_map_tokens:nn, \str_map_tokens:Nn, \str_map_tokens:cn}
+% \begin{syntax}
+% \cs{str_map_tokens:nn} \Arg{token list} \Arg{code}
+% \cs{str_map_tokens:Nn} \meta{str~var} \Arg{code}
+% \end{syntax}
+% Converts the \meta{token list} to a \meta{string} then applies
+% \meta{code} to every \meta{character} in the \meta{string} including
+% spaces. The \meta{code} receives each character as a trailing brace
+% group. This is equivalent to \cs{str_map_function:nN} if the
+% \meta{code} consists of a single function.
+% \end{function}
+%
% \begin{function}[added = 2017-10-08, rEXP]{\str_map_break:}
% \begin{syntax}
% \cs{str_map_break:}
@@ -1350,6 +1363,24 @@
% \end{macro}
% \end{macro}
%
+% \begin{macro}[rEXP]{\str_map_tokens:Nn, \str_map_tokens:cn}
+% \begin{macro}[rEXP]{\str_map_tokens:nn}
+% Uses an auxiliary of \cs{str_map_function:NN}.
+% \begin{macrocode}
+\cs_new:Npn \str_map_tokens:nn #1#2
+ {
+ \exp_args:Nno \use:nn
+ { \@@_map_function:w \@@_map_function:nn {#2} }
+ { \__kernel_tl_to_str:w {#1} }
+ \q_@@_recursion_tail ? ~
+ \prg_break_point:Nn \str_map_break: { }
+ }
+\cs_new:Npn \str_map_tokens:Nn { \exp_args:No \str_map_tokens:nn }
+\cs_generate_variant:Nn \str_map_tokens:Nn { c }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
% \subsection{Accessing specific characters in a string}
%
% \begin{macro}[EXP]{\__kernel_str_to_other:n}
More information about the latex3-commits
mailing list.