diff options
Diffstat (limited to 'macros/latex/contrib/l3kernel/l3candidates.dtx')
-rw-r--r-- | macros/latex/contrib/l3kernel/l3candidates.dtx | 273 |
1 files changed, 1 insertions, 272 deletions
diff --git a/macros/latex/contrib/l3kernel/l3candidates.dtx b/macros/latex/contrib/l3kernel/l3candidates.dtx index 4c08d8e422..4bbdc84bbb 100644 --- a/macros/latex/contrib/l3kernel/l3candidates.dtx +++ b/macros/latex/contrib/l3kernel/l3candidates.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2023-05-05} +% \date{Released 2023-05-11} % % \maketitle % @@ -86,24 +86,6 @@ % % \section{Additions to \pkg{l3seq}} % -% \begin{function}[rEXP] -% { -% \seq_mapthread_function:NNN, \seq_mapthread_function:NcN, -% \seq_mapthread_function:cNN, \seq_mapthread_function:ccN -% } -% \begin{syntax} -% \cs{seq_mapthread_function:NNN} \meta{seq_1} \meta{seq_2} \meta{function} -% \end{syntax} -% Applies \meta{function} to every pair of items -% \meta{seq_1-item}--\meta{seq_2-item} from the two sequences, returning -% items from both sequences from left to right. The \meta{function} -% receives two \texttt{n}-type arguments for each iteration. The mapping -% terminates when -% the end of either sequence is reached (\emph{i.e.}~whichever sequence has -% fewer items determines how many iterations -% occur). -% \end{function} -% % \begin{function}{\seq_set_filter:NNn, \seq_gset_filter:NNn} % \begin{syntax} % \cs{seq_set_filter:NNn} \meta{sequence_1} \meta{sequence_2} \Arg{inline boolexpr} @@ -119,42 +101,6 @@ % \end{texnote} % \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} -% \cs{seq_set_item:Nnn} \meta{seq~var} \Arg{int expr} \Arg{item} -% \cs{seq_set_item:NnnTF} \meta{seq~var} \Arg{int expr} \Arg{item} \Arg{true code} \Arg{false code} -% \end{syntax} -% Removes the item of \meta{sequence} at the position given by -% evaluating the \meta{int expr} and replaces it by -% \meta{item}. Items are indexed from $1$ on the left/top of the -% \meta{sequence}, or from $-1$ on the right/bottom. If the -% \meta{int expr} is zero or is larger (in absolute value) -% than the number of items in the sequence, the \meta{sequence} is not -% modified. In these cases, \cs{seq_set_item:Nnn} raises an error -% while \cs{seq_set_item:NnnTF} runs the \meta{false code}. In cases -% where the assignment was successful, \meta{true code} is run -% afterwards. -% \end{function} -% -% \begin{function}[added = 2021-04-28, noTF] -% {\seq_pop_item:NnN, \seq_pop_item:cnN, \seq_gpop_item:NnN, \seq_gpop_item:cnN} -% \begin{syntax} -% \cs{seq_pop_item:NnN} \meta{seq~var} \Arg{int expr} \Arg{tl~var} -% \cs{seq_pop_item:NnNTF} \meta{seq~var} \Arg{int expr} \Arg{tl~var} \Arg{true code} \Arg{false code} -% \end{syntax} -% Removes the \meta{item} at position \meta{int expr} in the -% \meta{sequence}, and places it in the \meta{token list variable}. -% Items are indexed from $1$ on the left/top of the \meta{sequence}, -% or from $-1$ on the right/bottom. If the position is zero or is -% larger (in absolute value) than the number of items in the sequence, -% the \meta{seq~var} is not modified, the \meta{token list} is set to -% the special marker \cs{q_no_value}, and the \meta{false code} is -% left in the input stream; otherwise the \meta{true code} is. The -% \meta{token list} assignment is local while the \meta{sequence} is -% assigned locally for |pop| or globally for |gpop| functions. -% \end{function} -% % \section{Additions to \pkg{l3tl}} % % \begin{function}[added = 2018-04-01]{\tl_build_begin:N, \tl_build_gbegin:N} @@ -241,53 +187,6 @@ %<@@=seq> % \end{macrocode} % -% \begin{macro} -% { -% \seq_mapthread_function:NNN, \seq_mapthread_function:NcN, -% \seq_mapthread_function:cNN, \seq_mapthread_function:ccN -% } -% \begin{macro} -% { -% \@@_mapthread_function:wNN, \@@_mapthread_function:wNw, -% \@@_mapthread_function:Nnnwnn -% } -% The idea is to first expand both sequences, adding the -% usual |{ ? \prg_break: } { }| to the end of each one. This is -% most conveniently done in two steps using an auxiliary function. -% The mapping then throws away the first tokens of |#2| and |#5|, -% which for items in both sequences are \cs{s_@@} -% \cs{@@_item:n}. The function to be mapped are then be applied to -% the two entries. When the code hits the end of one of the -% sequences, the break material stops the entire loop and tidy up. -% This avoids needing to find the count of the two sequences, or -% worrying about which is longer. -% \begin{macrocode} -\cs_new:Npn \seq_mapthread_function:NNN #1#2#3 - { \exp_after:wN \@@_mapthread_function:wNN #2 \s_@@_stop #1 #3 } -\cs_new:Npn \@@_mapthread_function:wNN \s_@@ #1 \s_@@_stop #2#3 - { - \exp_after:wN \@@_mapthread_function:wNw #2 \s_@@_stop #3 - #1 { ? \prg_break: } { } - \prg_break_point: - } -\cs_new:Npn \@@_mapthread_function:wNw \s_@@ #1 \s_@@_stop #2 - { - \@@_mapthread_function:Nnnwnn #2 - #1 { ? \prg_break: } { } - \s_@@_stop - } -\cs_new:Npn \@@_mapthread_function:Nnnwnn #1#2#3#4 \s_@@_stop #5#6 - { - \use_none:n #2 - \use_none:n #5 - #1 {#3} {#6} - \@@_mapthread_function:Nnnwnn #1 #4 \s_@@_stop - } -\cs_generate_variant:Nn \seq_mapthread_function:NNN { Nc , c , cc } -% \end{macrocode} -% \end{macro} -% \end{macro} -% % \begin{macro}{\seq_set_filter:NNn, \seq_gset_filter:NNn} % \begin{macro}{\@@_set_filter:NNNn} % Similar to \cs{seq_map_inline:Nn}, without a @@ -312,176 +211,6 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\@@_int_eval:w} -% Useful to more quickly go through items. -% \begin{macrocode} -\cs_new_eq:NN \@@_int_eval:w \tex_numexpr:D -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[noTF]{\seq_set_item:Nnn, \seq_set_item:cnn, \seq_gset_item:Nnn, \seq_gset_item:cnn} -% \begin{macro}{\@@_set_item:NnnNN, \@@_set_item:nnNNNN, \@@_set_item_false:nnNNNN, \@@_set_item:nNnnNNNN} -% \begin{macro}[rEXP]{\@@_set_item:wn, \@@_set_item_end:w} -% The conditionals are distinguished from the |Nnn| versions by the -% last argument \cs{use_ii:nn} vs \cs{use_i:nn}. -% \begin{macrocode} -\cs_new_protected:Npn \seq_set_item:Nnn #1#2#3 - { \@@_set_item:NnnNN #1 {#2} {#3} \__kernel_tl_set:Nx \use_i:nn } -\cs_new_protected:Npn \seq_gset_item:Nnn #1#2#3 - { \@@_set_item:NnnNN #1 {#2} {#3} \__kernel_tl_gset:Nx \use_i:nn } -\cs_generate_variant:Nn \seq_set_item:Nnn { c } -\cs_generate_variant:Nn \seq_gset_item:Nnn { c } -\prg_new_protected_conditional:Npnn \seq_set_item:Nnn #1#2#3 { TF , T , F } - { \@@_set_item:NnnNN #1 {#2} {#3} \__kernel_tl_set:Nx \use_ii:nn } -\prg_new_protected_conditional:Npnn \seq_gset_item:Nnn #1#2#3 { TF , T , F } - { \@@_set_item:NnnNN #1 {#2} {#3} \__kernel_tl_gset:Nx \use_ii:nn } -\prg_generate_conditional_variant:Nnn \seq_set_item:Nnn { c } { TF , T , F } -\prg_generate_conditional_variant:Nnn \seq_gset_item:Nnn { c } { TF , T , F } -% \end{macrocode} -% Save the item to be stored and evaluate the position and the sequence -% length only once. Then depending on the sign of the position, check -% that it is not bigger than the length (in absolute value) nor zero. -% \begin{macrocode} -\cs_new_protected:Npn \@@_set_item:NnnNN #1#2#3 - { - \tl_set:Nn \l_@@_internal_a_tl { \@@_item:n {#3} } - \exp_args:Nff \@@_set_item:nnNNNN - { \int_eval:n {#2} } { \seq_count:N #1 } #1 \use_none:nn - } -\cs_new_protected:Npn \@@_set_item:nnNNNN #1#2 - { - \int_compare:nNnTF {#1} > 0 - { \int_compare:nNnF {#1} > {#2} { \@@_set_item:nNnnNNNN { #1 - 1 } } } - { - \int_compare:nNnF {#1} < {-#2} - { - \int_compare:nNnF {#1} = 0 - { \@@_set_item:nNnnNNNN { #2 + #1 } } - } - } - \@@_set_item_false:nnNNNN {#1} {#2} - } -% \end{macrocode} -% If the position is not ok, \cs{@@_set_item_false:nnNNNN} calls an -% error or returns \texttt{false} (depending on the \cs{use_i:nn} vs -% \cs{use_ii:nn} argument mentioned above). -% \begin{macrocode} -\cs_new_protected:Npn \@@_set_item_false:nnNNNN #1#2#3#4#5#6 - { - #6 - { - \msg_error:nnxxx { seq } { item-too-large } - { \token_to_str:N #3 } {#2} {#1} - } - { \prg_return_false: } - } -\msg_new:nnnn { seq } { item-too-large } - { Sequence~'#1'~does~not~have~an~item~#3 } - { - An~attempt~was~made~to~push~or~pop~the~item~at~position~#3~ - of~'#1',~but~this~ - \int_compare:nTF { #3 = 0 } - { position~does~not~exist. } - { sequence~only~has~#2~item \int_compare:nF { #2 = 1 } {s}. } - } -% \end{macrocode} -% If the position is ok, \cs{@@_set_item:nNnnNNNN} makes the assignment -% and returns \texttt{true} (in the case of conditionnals). Here |#1| -% is an integer expression (position minus one), it needs to be -% evaluated. The sequence |#5| starts with \cs{s_@@} (even if empty), -% which stops the integer expression and is absorbed by it. The -% \cs{if_meaning:w} test is slightly faster than an integer test (but -% only works when testing against zero, hence the offset we chose in -% the position). When we are done skipping items, insert the saved -% item \cs{l_@@_internal_a_tl}. For |put| functions the last argument -% of \cs{@@_set_item_end:w} is \cs{use_none:nn} and it absorbs the -% item |#2| that we are removing: this is only useful for the |pop| -% functions. -% \begin{macrocode} -\cs_new_protected:Npn \@@_set_item:nNnnNNNN #1#2#3#4#5#6#7#8 - { - #7 #5 - { - \s_@@ - \exp_after:wN \@@_set_item:wn - \int_value:w \@@_int_eval:w #1 - #5 \s_@@_stop #6 - } - #8 { } { \prg_return_true: } - } -\cs_new:Npn \@@_set_item:wn #1 \@@_item:n #2 - { - \if_meaning:w 0 #1 \@@_set_item_end:w \fi: - \exp_not:n { \@@_item:n {#2} } - \exp_after:wN \@@_set_item:wn - \int_value:w \@@_int_eval:w #1 - 1 \s_@@ - } -\cs_new:Npn \@@_set_item_end:w #1 \exp_not:n #2 #3 \s_@@ #4 \s_@@_stop #5 - { - #1 - \exp_not:o \l_@@_internal_a_tl - \exp_not:n {#4} - #5 #2 - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}[noTF]{\seq_pop_item:NnN, \seq_pop_item:cnN, \seq_gpop_item:NnN, \seq_gpop_item:cnN} -% \begin{macro}{\@@_pop_item:NnNNN} -% The |NnN| versions simply call the conditionals, for which we will -% rely on the internals of \cs{seq_set_item:Nnn}. -% \begin{macrocode} -\cs_new_protected:Npn \seq_pop_item:NnN #1#2#3 - { \seq_pop_item:NnNTF #1 {#2} #3 { } { } } -\cs_new_protected:Npn \seq_gpop_item:NnN #1#2#3 - { \seq_gpop_item:NnNTF #1 {#2} #3 { } { } } -\cs_generate_variant:Nn \seq_pop_item:NnN { c } -\cs_generate_variant:Nn \seq_gpop_item:NnN { c } -\prg_new_protected_conditional:Npnn \seq_pop_item:NnN #1#2#3 { TF , T , F } - { \@@_pop_item:NnNN #1 {#2} #3 \__kernel_tl_set:Nx } -\prg_new_protected_conditional:Npnn \seq_gpop_item:NnN #1#2#3 { TF , T , F } - { \@@_pop_item:NnNN #1 {#2} #3 \__kernel_tl_gset:Nx } -\prg_generate_conditional_variant:Nnn \seq_pop_item:NnN { c } { TF , T , F } -\prg_generate_conditional_variant:Nnn \seq_gpop_item:NnN { c } { TF , T , F } -% \end{macrocode} -% Save in \cs{l_@@_internal_b_tl} the token list variable |#3| in -% which we will store the item. The \cs{@@_set_item:nnNNNN} auxiliary -% eventually inserts \cs{l_@@_internal_a_tl} in place of the item -% found in the sequence, so we empty that. Instead of the last -% argument \cs{use_i:nn} or \cs{use_ii:nn} used for |put| functions, -% we introduce \cs{@@_pop_item:nn}, which stores \cs{q_no_value} -% before calling its second argument -% (\cs{prg_return_true:}/\texttt{false:}) to end the conditional. The -% item found is passed to \cs{@@_pop_item_aux:w}, which interrupts the -% |x|-expanding sequence assignment and stores the item using the -% assignment function in \cs{l_@@_internal_b_tl}. -% \begin{macrocode} -\cs_new_protected:Npn \@@_pop_item:NnNN #1#2#3#4 - { - \tl_clear:N \l_@@_internal_a_tl - \tl_set:Nn \l_@@_internal_b_tl { \__kernel_tl_set:Nx #3 } - \exp_args:Nff \@@_set_item:nnNNNN - { \int_eval:n {#2} } { \seq_count:N #1 } - #1 \@@_pop_item_aux:w #4 \@@_pop_item:nn - } -\cs_new_protected:Npn \@@_pop_item:nn #1#2 - { - \if_meaning:w \prg_return_false: #2 - \l_@@_internal_b_tl { \exp_not:N \q_no_value } - \fi: - #2 - } -\cs_new:Npn \@@_pop_item_aux:w \@@_item:n #1 - { - \if_false: { \fi: } - \l_@@_internal_b_tl { \if_false: } \fi: \exp_not:n {#1} - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% % \subsection{Additions to \pkg{l3tl}} % % \subsubsection{Building a token list} |