From 7345b8683c7cbeaedf53e992fda0b3fa6141084e Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Sat, 7 Sep 2019 03:00:49 +0000 Subject: CTAN sync 201909070300 --- macros/latex/contrib/l3kernel/l3tl.dtx | 67 ++++++++++++++++++++++++++++------ 1 file changed, 56 insertions(+), 11 deletions(-) (limited to 'macros/latex/contrib/l3kernel/l3tl.dtx') diff --git a/macros/latex/contrib/l3kernel/l3tl.dtx b/macros/latex/contrib/l3kernel/l3tl.dtx index 77444e6d13..d0325848e3 100644 --- a/macros/latex/contrib/l3kernel/l3tl.dtx +++ b/macros/latex/contrib/l3kernel/l3tl.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-08-25} +% \date{Released 2019-09-05} % % \maketitle % @@ -353,7 +353,8 @@ % % \section{Token list conditionals} % -% \begin{function}[EXP,pTF]{\tl_if_blank:n, \tl_if_blank:V, \tl_if_blank:o} +% \begin{function}[EXP,pTF, updated = 2019-09-04] +% {\tl_if_blank:n, \tl_if_blank:e, \tl_if_blank:V, \tl_if_blank:o} % \begin{syntax} % \cs{tl_if_blank_p:n} \Arg{token list} % \cs{tl_if_blank:nTF} \Arg{token list} \Arg{true code} \Arg{false code} @@ -551,6 +552,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} @@ -1065,12 +1085,11 @@ % Leaves in the input stream the items from the \meta{start index} to the % \meta{end index} inclusive. Spaces and braces are preserved between % the items returned (but never at either end of the list). -% % Here \meta{start index} and \meta{end index} should be integer denotations. % For describing in detail the functions' behavior, let $m$ and $n$ be the start % and end index respectively. If either is $0$, the result is empty. A positive -% index means `start counting from the left end', a negative index means -% `start counting from the right end'. Let $l$ be the count of the token list. +% index means `start counting from the left end', and a negative index means +% `from the right end'. Let $l$ be the count of the token list. % % The \emph{actual start point} is determined as $M=m$ if~$m>0$ and as $M=l+m+1$ % if~$m<0$. Similarly the \emph{actual end point} is $N=n$ if~$n>0$ and $N=l+n+1$ @@ -1110,16 +1129,17 @@ % \begin{verbatim} % \tl_range:nnn { abcd~{e{}}f } { 2 } { 4 } % \end{verbatim} -% will discard the space after `d`. +% will discard the space after `d'. % -% If we want to get the items from the third to the last, the call +% If we want to get the items from, say, the third to the last in a token +% list ||, the call % is |\tl_range:nnn { } { 3 } { -1 }|. Similarly, for discarding % the last item, we can do |\tl_range:nnn { } { 1 } { -2 }|. % -% The behavior of \cs{tl_range:Nnn} is exactly the same, acting on the -% contents of the tl variable. +%^^A The behavior of \cs{tl_range:Nnn} is exactly the same, acting on the +%^^A contents of the tl variable. % -% For improved performance, see \cs{tl_range_braced:nnn} and +% For better performance, see \cs{tl_range_braced:nnn} and % \cs{tl_range_unbraced:nnn}. % \begin{texnote} % The result is returned within the \tn{unexpanded} @@ -2033,7 +2053,7 @@ \fi: } \prg_generate_conditional_variant:Nnn \tl_if_blank:n - { V , o } { p , T , F , TF } + { e , V , o } { p , T , F , TF } % \end{macrocode} % \end{macro} % \end{macro} @@ -2408,6 +2428,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} -- cgit v1.2.3