[latex3-commits] [l3svn] r6116 - Add \bool_(and|or)_p:nn, \bool_(all|any)_p:n

noreply at latex-project.org noreply at latex-project.org
Tue Sep 29 16:20:27 CEST 2015


Author: bruno
Date: 2015-09-29 16:20:27 +0200 (Tue, 29 Sep 2015)
New Revision: 6116

Modified:
   trunk/l3kernel/l3prg.dtx
   trunk/l3kernel/testfiles/m3expl001.luatex.tlg
   trunk/l3kernel/testfiles/m3expl001.ptex.tlg
   trunk/l3kernel/testfiles/m3expl001.tlg
   trunk/l3kernel/testfiles/m3expl001.uptex.tlg
   trunk/l3kernel/testfiles/m3expl001.xetex.tlg
   trunk/l3kernel/testfiles/m3expl003.luatex.tlg
   trunk/l3kernel/testfiles/m3expl003.ptex.tlg
   trunk/l3kernel/testfiles/m3expl003.tlg
   trunk/l3kernel/testfiles/m3expl003.uptex.tlg
   trunk/l3kernel/testfiles/m3expl003.xetex.tlg
   trunk/l3kernel/testfiles/m3prg003.lvt
   trunk/l3kernel/testfiles/m3prg003.tlg
Log:
Add \bool_(and|or)_p:nn, \bool_(all|any)_p:n

This commit adds \bool_and_p:nn and \bool_or_p:nn which
implement lazy versions of "&&" and "||".  It also adds
\bool_all_p:n and \bool_any_p:n which implement lazy "&&"
and "||" on an arbitrary number of boolean expressions,
given as a list of braced items.


Modified: trunk/l3kernel/l3prg.dtx
===================================================================
--- trunk/l3kernel/l3prg.dtx	2015-09-29 12:06:31 UTC (rev 6115)
+++ trunk/l3kernel/l3prg.dtx	2015-09-29 14:20:27 UTC (rev 6116)
@@ -72,9 +72,7 @@
 % performs a series of tests, possibly involving assignments and
 % calling other functions that do not read further ahead in the input
 % stream. After processing the input, a \emph{state} is returned. The
-% typical states returned are \meta{true} and \meta{false} but other
-% states are possible, say an \meta{error} state for erroneous
-% input, \emph{e.g.}, text as input in a function comparing integers.
+% states returned are \meta{true} and \meta{false}.
 %
 % \LaTeX3 has two forms of conditional flow processing based
 % on these states. The first form is predicate functions that turn the
@@ -87,9 +85,13 @@
 % input stream based on the result of the testing as in
 % \cs{cs_if_free:NTF} which also takes one argument (the |N|) and then
 % executes either \texttt{true} or \texttt{false} depending on the
-% result. Important to note here is that the arguments are executed
-% after exiting the underlying |\if...\fi:| structure.
+% result.
 %
+% \begin{texnote}
+%   The arguments are executed after exiting the underlying
+%   |\if...\fi:| structure.
+% \end{texnote}
+%
 % \section{Defining a set of conditional functions}
 % \label{sec:l3prg:new-conditional-functions}
 %
@@ -140,7 +142,7 @@
 %     which will supply either a logical \texttt{true} or logical
 %     \texttt{false}. This function is intended for use in cases where
 %     one or more logical tests are combined to lead to a final outcome.
-%     This function will not work properly for \texttt{protected}
+%     This function cannot be defined for \texttt{protected}
 %     conditionals.
 %   \item \cs{\meta{name}:\meta{arg spec}T} --- a function with one more
 %     argument than the original \meta{arg spec} demands. The \meta{true
@@ -192,7 +194,7 @@
 %   \begin{syntax}
 %     \cs{prg_new_eq_conditional:NNn} \cs{\meta{name_1}:\meta{arg spec_1}} \cs{\meta{name_2}:\meta{arg spec_2}} \Arg{conditions}
 %   \end{syntax}
-%   These functions copies a family of conditionals. The \texttt{new} version
+%   These functions copy a family of conditionals. The \texttt{new} version
 %   will check for existing definitions (\emph{cf.}~\cs{cs_new:Npn}) whereas
 %   the \texttt{set} version will not (\emph{cf.}~\cs{cs_set:Npn}). The
 %   conditionals copied are depended on the comma-separated list of
@@ -208,7 +210,7 @@
 %   These `return' functions define the logical state of a conditional statement.
 %   They appear within the code for a conditional
 %   function generated by \cs{prg_set_conditional:Npnn}, \emph{etc}, to indicate
-%   when a true or false branch has been taken.
+%   when a true or false branch should be taken.
 %   While they may appear multiple times each within the code of such conditionals,
 %   the execution of the conditional must result in the expansion of one of these
 %   two functions \emph{exactly once}.
@@ -357,23 +359,47 @@
 % of predicate functions and boolean variables, return boolean
 % \meta{true} or \meta{false}. It supports the logical operations And,
 % Or and Not as the well-known infix operators |&&|, \verb"||" and |!|
-% with their usual precedences. In
+% with their usual precedences (namely, |&&| binds more tightly than
+% \verb"||"). In
 % addition to this, parentheses can be used to isolate
 % sub-expressions. For example,
 % \begin{verbatim}
 %     \int_compare_p:n { 1 = 1 } &&
 %       (
 %         \int_compare_p:n { 2 = 3 } ||
-%         \int_compare_p:n { 4 = 4 } ||
-%         \int_compare_p:n { 1 = \error } % is skipped
+%         \int_compare_p:n { 4 <= 4 } ||
+%         \str_if_eq_p:nn { abc } { def }
 %       ) &&
-%     ! ( \int_compare_p:n { 2 = 4 } )
+%     ! \int_compare_p:n { 2 = 4 }
 % \end{verbatim}
-% is a valid boolean expression. Note that minimal evaluation is
-% carried out whenever possible so that whenever a truth value cannot
-% be changed any more, the remaining tests within the current group
-% are skipped.
+% is a valid boolean expression.
 %
+% Minimal (lazy) evaluation can be obtained using the functions
+% \cs{bool_all_p:n}, \cs{bool_and_p:nn}, \cs{bool_any_p:n}, or
+% \cs{bool_or_p:nn}, which only evaluate their boolean expression
+% arguments when they are needed to determine the resulting truth
+% value.  For example, when evaluating the boolean expression
+% \begin{verbatim}
+%     \bool_and_p:nn
+%       {
+%         \bool_any_p:n
+%           {
+%             { \int_compare_p:n { 2 = 3 } }
+%             { \int_compare_p:n { 4 <= 4 } }
+%             { \int_compare_p:n { 1 = \error } } % is skipped
+%           }
+%       }
+%       { ! \int_compare_p:n { 2 = 4 } }
+% \end{verbatim}
+% the line marked with |is skipped| is not expanded because the result
+% of \cs{bool_any_p:n} is known once the second boolean expression is
+% found to be logically \texttt{true}.  On the other hand, the last
+% line is expanded because its logical value is needed to determine the
+% result of \cs{bool_and_p:nn}.
+%
+% At present, the infix operators |&&| and \verb"||" perform lazy
+% evaluation as well, but this will change in a future release.
+%
 % \begin{function}[EXP, pTF, updated = 2012-07-08]{\bool_if:n}
 %   \begin{syntax}
 %     \cs{bool_if_p:n} \Arg{boolean expression}
@@ -384,28 +410,73 @@
 %   \meta{boolean expression} should consist of a series of predicates
 %   or boolean variables with the logical relationship between these
 %   defined using |&&| (\enquote{And}), \verb"||" (\enquote{Or}),
-%   |!| (\enquote{Not}) and parentheses. Minimal evaluation is used
-%   in the processing, so that once a result is defined there is
-%   not further expansion of the tests. For example
+%   |!| (\enquote{Not}) and parentheses.  The logical Not applies to
+%   the next predicate or group.  Minimal evaluation can be
+%   obtained using the predicate functions \cs{bool_all_p:n},
+%   \cs{bool_and_p:nn}, \cs{bool_any_p:n} and \cs{bool_or_p:nn}. For
+%   example
 %   \begin{verbatim}
 %     \bool_if_p:n
 %       {
 %        \int_compare_p:nNn { 1 } = { 1 }
 %        &&
 %        (
-%          \int_compare_p:nNn { 2 } = { 3 } ||
-%          \int_compare_p:nNn { 4 } = { 4 } ||
-%          \int_compare_p:nNn { 1 } = { \error } % is skipped
+%          \bool_or_p:nn
+%            { \int_compare_p:nNn { 2 } = { 3 } }
+%            {
+%              \bool_or_p:nn
+%                { \int_compare_p:nNn { 4 } = { 4 } }
+%                { \int_compare_p:nNn { 1 } = { \error } } % is skipped
+%            }
 %        )
 %        &&
 %        ! \int_compare_p:nNn { 2 } = { 4 }
 %     }
 %   \end{verbatim}
 %   will be \texttt{true} and will not evaluate
-%   |\int_compare_p:nNn { 1 } = { \error }|. The logical Not applies to
-%   the next predicate or group.
+%   |\int_compare_p:nNn { 1 } = { \error }|.
+%   Nested uses of \cs{bool_or_p:nn} can also be replaced by
+%   \cs{bool_any_p:n}.
 % \end{function}
 %
+% \begin{function}[EXP, added = 2015-09-28]{\bool_all_p:n}
+%   \begin{syntax}
+%     \cs{bool_all_p:n} \{ \Arg{boolexpr_1} \Arg{boolexpr_2} \cdots \Arg{boolexpr_N} \}
+%   \end{syntax}
+%   Implements the \enquote{And} operation on the \meta{boolean
+%   expressions}, hence is \texttt{true} if all of them are
+%   \texttt{true} and \texttt{false} if any of them is \texttt{false}.
+%   Contrarily to the infix operator |&&|, only the \meta{boolean
+%   expressions} which are needed to determine the result of
+%   \cs{bool_all_p:n} will be evaluated.  See also \cs{bool_and_p:nn}
+%   when there are only two \meta{boolean expressions}.
+% \end{function}
+%
+% \begin{function}[EXP, added = 2015-09-28]{\bool_and_p:nn}
+%   \begin{syntax}
+%     \cs{bool_and_p:nn} \Arg{boolexpr_1} \Arg{boolexpr_2}
+%   \end{syntax}
+%   Implements the \enquote{And} operation between two boolean
+%   expressions, hence is \texttt{true} if both are \texttt{true}.
+%   Contrarily to the infix operator |&&|, the \meta{boolexpr_2} will
+%   only be evaluated if it is needed to determine the result of
+%   \cs{bool_and_p:nn}.  See also \cs{bool_all_p:n} when there are more
+%   than two \meta{boolean expressions}.
+% \end{function}
+%
+% \begin{function}[EXP, added = 2015-09-28]{\bool_any_p:n}
+%   \begin{syntax}
+%     \cs{bool_any_p:n} \{ \Arg{boolexpr_1} \Arg{boolexpr_2} \cdots \Arg{boolexpr_N} \}
+%   \end{syntax}
+%   Implements the \enquote{Or} operation on the \meta{boolean
+%   expressions}, hence is \texttt{true} if any of them is
+%   \texttt{true} and \texttt{false} if all of them are \texttt{false}.
+%   Contrarily to the infix operator \verb"||", only the \meta{boolean
+%   expressions} which are needed to determine the result of
+%   \cs{bool_any_p:n} will be evaluated.  See also \cs{bool_or_p:nn}
+%   when there are only two \meta{boolean expressions}.
+% \end{function}
+%
 % \begin{function}[EXP, updated = 2012-07-08]{\bool_not_p:n}
 %   \begin{syntax}
 %      \cs{bool_not_p:n} \Arg{boolean expression}
@@ -414,6 +485,18 @@
 %   expression.
 % \end{function}
 %
+% \begin{function}[EXP, added = 2015-09-28]{\bool_or_p:nn}
+%   \begin{syntax}
+%     \cs{bool_or_p:nn} \Arg{boolexpr_1} \Arg{boolexpr_2}
+%   \end{syntax}
+%   Implements the \enquote{Or} operation between two boolean
+%   expressions, hence is \texttt{true} if either one is \texttt{true}.
+%   Contrarily to the infix operator \verb"||", the \meta{boolexpr_2}
+%   will only be evaluated if it is needed to determine the result of
+%   \cs{bool_or_p:nn}.  See also \cs{bool_any_p:n} when there are more
+%   than two \meta{boolean expressions}.
+% \end{function}
+%
 % \begin{function}[EXP, updated = 2012-07-08]{\bool_xor_p:nn}
 %   \begin{syntax}
 %     \cs{bool_xor_p:nn} \Arg{boolexpr_1} \Arg{boolexpr_2}
@@ -568,17 +651,17 @@
 %
 % \begin{function}[EXP]{\if_predicate:w}
 %   \begin{syntax}
-%     "\if_predicate:w" <predicate> <true code> "\else:" <false code> "\fi:"
+%     \cs{if_predicate:w} \meta{predicate} \meta{true code} \cs{else:} \meta{false code} \cs{fi:}
 %   \end{syntax}
 %   This function takes a predicate function and
 %   branches according to the result.  (In practice this function would also
-%   accept a single boolean variable in place of the <predicate> but to make the
-%   coding clearer this should be done through "\if_bool:N".)
+%   accept a single boolean variable in place of the \meta{predicate} but to make the
+%   coding clearer this should be done through \cs{if_bool:N}.)
 % \end{function}
 %
 % \begin{function}[EXP]{\if_bool:N}
 %   \begin{syntax}
-%     "\if_bool:N" <boolean> <true code> "\else:" <false code> "\fi:"
+%     \cs{if_bool:N} \meta{boolean} \meta{true code} \cs{else:} \meta{false code} \cs{fi:}
 %   \end{syntax}
 %   This function takes a boolean variable and
 %   branches according to the result.
@@ -664,7 +747,7 @@
 % \section{\pkg{l3prg} implementation}
 %
 % \TestFiles{m3prg001.lvt,m3prg002.lvt,m3prg003.lvt}
-%%
+%
 %    \begin{macrocode}
 %<*initex|package>
 %    \end{macrocode}
@@ -1128,7 +1211,7 @@
 % \begin{macro}[aux]+\@@_&_1:w+
 % \begin{macro}[aux]+\@@_|_0:w+
 %   Two cases where we simply continue scanning.  We must remove the
-%   second "&" or \verb"|".
+%   second |&| or \verb"|".
 %    \begin{macrocode}
 \cs_new_nopar:cpn { @@_&_1:w } & { \@@_get_next:NN \use_i:nn }
 \cs_new_nopar:cpn { @@_|_0:w } | { \@@_get_next:NN \use_i:nn }
@@ -1237,6 +1320,52 @@
 % \end{macro}
 % \end{macro}
 %
+% \begin{macro}{\bool_all_p:n}
+% \begin{macro}[aux]{\@@_all_aux:n}
+%   Go through the list of expressions, stopping whenever an expression
+%   is \texttt{false}.  If the end is reached without finding any
+%   \texttt{false} expression, then the result is \texttt{true}.
+%    \begin{macrocode}
+\cs_new:Npn \bool_all_p:n #1
+  { \@@_all_aux:n #1 \q_recursion_tail \q_recursion_stop }
+\cs_new:Npn \@@_all_aux:n #1
+  {
+    \quark_if_recursion_tail_stop_do:nn {#1} { \c_true_bool }
+    \bool_if:nF {#1}
+      { \use_i_delimit_by_q_recursion_stop:nw { \c_false_bool } }
+    \@@_all_aux:n
+  }
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\bool_and_p:nn}
+%   Only evaluate the second expression if the first is \texttt{true}.
+%    \begin{macrocode}
+\cs_new:Npn \bool_and_p:nn #1#2
+  { \bool_if:nTF {#1} { \bool_if_p:n {#2} } { \c_false_bool } }
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\bool_any_p:n}
+% \begin{macro}[aux]{\@@_any_aux:n}
+%   Go through the list of expressions, stopping whenever an expression
+%   is \texttt{true}.  If the end is reached without finding any
+%   \texttt{true} expression, then the result is \texttt{false}.
+%    \begin{macrocode}
+\cs_new:Npn \bool_any_p:n #1
+  { \@@_any_aux:n #1 \q_recursion_tail \q_recursion_stop }
+\cs_new:Npn \@@_any_aux:n #1
+  {
+    \quark_if_recursion_tail_stop_do:nn {#1} { \c_false_bool }
+    \bool_if:nT {#1}
+      { \use_i_delimit_by_q_recursion_stop:nw { \c_true_bool } }
+    \@@_any_aux:n
+  }
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
 % \begin{macro}{\bool_not_p:n}
 % \UnitTested
 %   The Not variant just reverses the outcome of \cs{bool_if_p:n}. Can
@@ -1248,6 +1377,14 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}{\bool_or_p:nn}
+%   Only evaluate the second expression if the first is \texttt{false}.
+%    \begin{macrocode}
+\cs_new:Npn \bool_or_p:nn #1#2
+  { \bool_if:nTF {#1} { \c_true_bool } { \bool_if_p:n {#2} } }
+%    \end{macrocode}
+% \end{macro}
+%
 % \begin{macro}{\bool_xor_p:nn}
 % \UnitTested
 %    Exclusive or. If the boolean expressions have same truth value,

Modified: trunk/l3kernel/testfiles/m3expl001.luatex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.luatex.tlg	2015-09-29 12:06:31 UTC (rev 6115)
+++ trunk/l3kernel/testfiles/m3expl001.luatex.tlg	2015-09-29 14:20:27 UTC (rev 6116)
@@ -1439,7 +1439,13 @@
 Defining \__bool_eval_skip_to_end_auxi:Nw on line ...
 Defining \__bool_eval_skip_to_end_auxii:Nw on line ...
 Defining \__bool_eval_skip_to_end_auxiii:Nw on line ...
+Defining \bool_all_p:n on line ...
+Defining \__bool_all_aux:n on line ...
+Defining \bool_and_p:nn on line ...
+Defining \bool_any_p:n on line ...
+Defining \__bool_any_aux:n on line ...
 Defining \bool_not_p:n on line ...
+Defining \bool_or_p:nn on line ...
 Defining \bool_xor_p:nn on line ...
 Defining \bool_while_do:Nn on line ...
 Defining \bool_until_do:Nn on line ...

Modified: trunk/l3kernel/testfiles/m3expl001.ptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.ptex.tlg	2015-09-29 12:06:31 UTC (rev 6115)
+++ trunk/l3kernel/testfiles/m3expl001.ptex.tlg	2015-09-29 14:20:27 UTC (rev 6116)
@@ -1438,7 +1438,13 @@
 Defining \__bool_eval_skip_to_end_auxi:Nw on line ...
 Defining \__bool_eval_skip_to_end_auxii:Nw on line ...
 Defining \__bool_eval_skip_to_end_auxiii:Nw on line ...
+Defining \bool_all_p:n on line ...
+Defining \__bool_all_aux:n on line ...
+Defining \bool_and_p:nn on line ...
+Defining \bool_any_p:n on line ...
+Defining \__bool_any_aux:n on line ...
 Defining \bool_not_p:n on line ...
+Defining \bool_or_p:nn on line ...
 Defining \bool_xor_p:nn on line ...
 Defining \bool_while_do:Nn on line ...
 Defining \bool_until_do:Nn on line ...

Modified: trunk/l3kernel/testfiles/m3expl001.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.tlg	2015-09-29 12:06:31 UTC (rev 6115)
+++ trunk/l3kernel/testfiles/m3expl001.tlg	2015-09-29 14:20:27 UTC (rev 6116)
@@ -1438,7 +1438,13 @@
 Defining \__bool_eval_skip_to_end_auxi:Nw on line ...
 Defining \__bool_eval_skip_to_end_auxii:Nw on line ...
 Defining \__bool_eval_skip_to_end_auxiii:Nw on line ...
+Defining \bool_all_p:n on line ...
+Defining \__bool_all_aux:n on line ...
+Defining \bool_and_p:nn on line ...
+Defining \bool_any_p:n on line ...
+Defining \__bool_any_aux:n on line ...
 Defining \bool_not_p:n on line ...
+Defining \bool_or_p:nn on line ...
 Defining \bool_xor_p:nn on line ...
 Defining \bool_while_do:Nn on line ...
 Defining \bool_until_do:Nn on line ...

Modified: trunk/l3kernel/testfiles/m3expl001.uptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.uptex.tlg	2015-09-29 12:06:31 UTC (rev 6115)
+++ trunk/l3kernel/testfiles/m3expl001.uptex.tlg	2015-09-29 14:20:27 UTC (rev 6116)
@@ -1438,7 +1438,13 @@
 Defining \__bool_eval_skip_to_end_auxi:Nw on line ...
 Defining \__bool_eval_skip_to_end_auxii:Nw on line ...
 Defining \__bool_eval_skip_to_end_auxiii:Nw on line ...
+Defining \bool_all_p:n on line ...
+Defining \__bool_all_aux:n on line ...
+Defining \bool_and_p:nn on line ...
+Defining \bool_any_p:n on line ...
+Defining \__bool_any_aux:n on line ...
 Defining \bool_not_p:n on line ...
+Defining \bool_or_p:nn on line ...
 Defining \bool_xor_p:nn on line ...
 Defining \bool_while_do:Nn on line ...
 Defining \bool_until_do:Nn on line ...

Modified: trunk/l3kernel/testfiles/m3expl001.xetex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.xetex.tlg	2015-09-29 12:06:31 UTC (rev 6115)
+++ trunk/l3kernel/testfiles/m3expl001.xetex.tlg	2015-09-29 14:20:27 UTC (rev 6116)
@@ -1438,7 +1438,13 @@
 Defining \__bool_eval_skip_to_end_auxi:Nw on line ...
 Defining \__bool_eval_skip_to_end_auxii:Nw on line ...
 Defining \__bool_eval_skip_to_end_auxiii:Nw on line ...
+Defining \bool_all_p:n on line ...
+Defining \__bool_all_aux:n on line ...
+Defining \bool_and_p:nn on line ...
+Defining \bool_any_p:n on line ...
+Defining \__bool_any_aux:n on line ...
 Defining \bool_not_p:n on line ...
+Defining \bool_or_p:nn on line ...
 Defining \bool_xor_p:nn on line ...
 Defining \bool_while_do:Nn on line ...
 Defining \bool_until_do:Nn on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.luatex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.luatex.tlg	2015-09-29 12:06:31 UTC (rev 6115)
+++ trunk/l3kernel/testfiles/m3expl003.luatex.tlg	2015-09-29 14:20:27 UTC (rev 6116)
@@ -1439,7 +1439,13 @@
 Defining \__bool_eval_skip_to_end_auxi:Nw on line ...
 Defining \__bool_eval_skip_to_end_auxii:Nw on line ...
 Defining \__bool_eval_skip_to_end_auxiii:Nw on line ...
+Defining \bool_all_p:n on line ...
+Defining \__bool_all_aux:n on line ...
+Defining \bool_and_p:nn on line ...
+Defining \bool_any_p:n on line ...
+Defining \__bool_any_aux:n on line ...
 Defining \bool_not_p:n on line ...
+Defining \bool_or_p:nn on line ...
 Defining \bool_xor_p:nn on line ...
 Defining \bool_while_do:Nn on line ...
 Defining \bool_until_do:Nn on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.ptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.ptex.tlg	2015-09-29 12:06:31 UTC (rev 6115)
+++ trunk/l3kernel/testfiles/m3expl003.ptex.tlg	2015-09-29 14:20:27 UTC (rev 6116)
@@ -1438,7 +1438,13 @@
 Defining \__bool_eval_skip_to_end_auxi:Nw on line ...
 Defining \__bool_eval_skip_to_end_auxii:Nw on line ...
 Defining \__bool_eval_skip_to_end_auxiii:Nw on line ...
+Defining \bool_all_p:n on line ...
+Defining \__bool_all_aux:n on line ...
+Defining \bool_and_p:nn on line ...
+Defining \bool_any_p:n on line ...
+Defining \__bool_any_aux:n on line ...
 Defining \bool_not_p:n on line ...
+Defining \bool_or_p:nn on line ...
 Defining \bool_xor_p:nn on line ...
 Defining \bool_while_do:Nn on line ...
 Defining \bool_until_do:Nn on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.tlg	2015-09-29 12:06:31 UTC (rev 6115)
+++ trunk/l3kernel/testfiles/m3expl003.tlg	2015-09-29 14:20:27 UTC (rev 6116)
@@ -1438,7 +1438,13 @@
 Defining \__bool_eval_skip_to_end_auxi:Nw on line ...
 Defining \__bool_eval_skip_to_end_auxii:Nw on line ...
 Defining \__bool_eval_skip_to_end_auxiii:Nw on line ...
+Defining \bool_all_p:n on line ...
+Defining \__bool_all_aux:n on line ...
+Defining \bool_and_p:nn on line ...
+Defining \bool_any_p:n on line ...
+Defining \__bool_any_aux:n on line ...
 Defining \bool_not_p:n on line ...
+Defining \bool_or_p:nn on line ...
 Defining \bool_xor_p:nn on line ...
 Defining \bool_while_do:Nn on line ...
 Defining \bool_until_do:Nn on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.uptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.uptex.tlg	2015-09-29 12:06:31 UTC (rev 6115)
+++ trunk/l3kernel/testfiles/m3expl003.uptex.tlg	2015-09-29 14:20:27 UTC (rev 6116)
@@ -1438,7 +1438,13 @@
 Defining \__bool_eval_skip_to_end_auxi:Nw on line ...
 Defining \__bool_eval_skip_to_end_auxii:Nw on line ...
 Defining \__bool_eval_skip_to_end_auxiii:Nw on line ...
+Defining \bool_all_p:n on line ...
+Defining \__bool_all_aux:n on line ...
+Defining \bool_and_p:nn on line ...
+Defining \bool_any_p:n on line ...
+Defining \__bool_any_aux:n on line ...
 Defining \bool_not_p:n on line ...
+Defining \bool_or_p:nn on line ...
 Defining \bool_xor_p:nn on line ...
 Defining \bool_while_do:Nn on line ...
 Defining \bool_until_do:Nn on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.xetex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.xetex.tlg	2015-09-29 12:06:31 UTC (rev 6115)
+++ trunk/l3kernel/testfiles/m3expl003.xetex.tlg	2015-09-29 14:20:27 UTC (rev 6116)
@@ -1438,7 +1438,13 @@
 Defining \__bool_eval_skip_to_end_auxi:Nw on line ...
 Defining \__bool_eval_skip_to_end_auxii:Nw on line ...
 Defining \__bool_eval_skip_to_end_auxiii:Nw on line ...
+Defining \bool_all_p:n on line ...
+Defining \__bool_all_aux:n on line ...
+Defining \bool_and_p:nn on line ...
+Defining \bool_any_p:n on line ...
+Defining \__bool_any_aux:n on line ...
 Defining \bool_not_p:n on line ...
+Defining \bool_or_p:nn on line ...
 Defining \bool_xor_p:nn on line ...
 Defining \bool_while_do:Nn on line ...
 Defining \bool_until_do:Nn on line ...

Modified: trunk/l3kernel/testfiles/m3prg003.lvt
===================================================================
--- trunk/l3kernel/testfiles/m3prg003.lvt	2015-09-29 12:06:31 UTC (rev 6115)
+++ trunk/l3kernel/testfiles/m3prg003.lvt	2015-09-29 14:20:27 UTC (rev 6116)
@@ -82,7 +82,6 @@
   }
 }
 
-
 \TESTEXP{XOR}{
   \bool_xor_p:nn { \c_true_bool  }{ \c_true_bool  }  \NEWLINE
   \bool_xor_p:nn { \c_true_bool  }{ \c_false_bool }  \NEWLINE
@@ -237,4 +236,32 @@
   \bool_if:nTF { ! (\c_false_bool && !(\c_false_bool)) }{pass}{fail}
 }
 
+\TESTEXP{Lazy~ALL}{
+  \bool_all_p:n { { \c_true_bool  }{ \c_true_bool  } { \c_true_bool  } }  \NEWLINE
+  \bool_all_p:n { { \c_true_bool  }{ \c_true_bool  } { \c_false_bool } \BOOM ... }  \NEWLINE
+  \bool_all_p:n { { \c_true_bool  }{ \c_false_bool } \BOOM ... } \NEWLINE
+  \bool_all_p:n { { \c_false_bool } \BOOM ... } \NEWLINE
+  \bool_all_p:n { }
+}
+
+\TESTEXP{Lazy~AND}{
+  \bool_and_p:nn { \c_true_bool  }{ \c_true_bool  }  \NEWLINE
+  \bool_and_p:nn { \c_true_bool  }{ \c_false_bool }  \NEWLINE
+  \bool_and_p:nn { \c_false_bool }{ \BOOM  }
+}
+
+\TESTEXP{Lazy~ANY}{
+  \bool_any_p:n { { \c_false_bool  }{ \c_false_bool  } { \c_false_bool  } }  \NEWLINE
+  \bool_any_p:n { { \c_false_bool  }{ \c_false_bool  } { \c_true_bool } \BOOM ... }  \NEWLINE
+  \bool_any_p:n { { \c_false_bool  }{ \c_true_bool } \BOOM ... } \NEWLINE
+  \bool_any_p:n { { \c_true_bool } \BOOM ... } \NEWLINE
+  \bool_any_p:n { }
+}
+
+\TESTEXP{Lazy~OR}{
+  \bool_or_p:nn { \c_true_bool  }{ \BOOM  }  \NEWLINE
+  \bool_or_p:nn { \c_false_bool }{ \c_true_bool  }  \NEWLINE
+  \bool_or_p:nn { \c_false_bool }{ \c_false_bool }
+}
+
 \END

Modified: trunk/l3kernel/testfiles/m3prg003.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3prg003.tlg	2015-09-29 12:06:31 UTC (rev 6115)
+++ trunk/l3kernel/testfiles/m3prg003.tlg	2015-09-29 14:20:27 UTC (rev 6116)
@@ -232,3 +232,35 @@
 pass
 pass
 ============================================================
+============================================================
+TEST 15: Lazy ALL
+============================================================
+\c_true_bool 
+\c_false_bool 
+\c_false_bool 
+\c_false_bool 
+\c_true_bool 
+============================================================
+============================================================
+TEST 16: Lazy AND
+============================================================
+\c_true_bool 
+\c_false_bool 
+\c_false_bool 
+============================================================
+============================================================
+TEST 17: Lazy ANY
+============================================================
+\c_false_bool 
+\c_true_bool 
+\c_true_bool 
+\c_true_bool 
+\c_false_bool 
+============================================================
+============================================================
+TEST 18: Lazy OR
+============================================================
+\c_true_bool 
+\c_true_bool 
+\c_false_bool 
+============================================================



More information about the latex3-commits mailing list