texlive[63034] Master/texmf-dist: functional (15apr22)
commits+karl at tug.org
commits+karl at tug.org
Fri Apr 15 23:13:40 CEST 2022
Revision: 63034
http://tug.org/svn/texlive?view=revision&revision=63034
Author: karl
Date: 2022-04-15 23:13:40 +0200 (Fri, 15 Apr 2022)
Log Message:
-----------
functional (15apr22)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/functional/functional.pdf
trunk/Master/texmf-dist/doc/latex/functional/functional.tex
trunk/Master/texmf-dist/tex/latex/functional/functional.sty
Modified: trunk/Master/texmf-dist/doc/latex/functional/functional.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/functional/functional.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/functional/functional.tex 2022-04-15 05:19:42 UTC (rev 63033)
+++ trunk/Master/texmf-dist/doc/latex/functional/functional.tex 2022-04-15 21:13:40 UTC (rev 63034)
@@ -3,7 +3,7 @@
\documentclass[oneside]{book}
\usepackage[a4paper,margin=2.5cm]{geometry}
-\newcommand*{\myversion}{2022C}
+\newcommand*{\myversion}{2022D}
\newcommand*{\mydate}{Version \myversion\ (\the\year-\mylpad\month-\mylpad\day)}
\newcommand*{\mylpad}[1]{\ifnum#1<10 0\the#1\else\the#1\fi}
@@ -133,7 +133,7 @@
\IgnoreSpacesOn
\PrgNewFunction \MathSquare { m } {
\IntSet \lTmpaInt { \IntEval {#1 * #1} }
- \Result { \Value \lTmpaInt }
+ \Return { \Value \lTmpaInt }
}
\IgnoreSpacesOff
\MathSquare{5}
@@ -156,7 +156,7 @@
%\IgnoreSpacesOn
%\PrgNewFunction \MathSquare { m }{
% \IntSet \lTmpaInt { \IntEval { #1 * #1 } }
-% \Result { \Value \lTmpaInt }
+% \Return { \Value \lTmpaInt }
%}
%\IgnoreSpacesOff
%\MathSquare{5}
@@ -166,7 +166,7 @@
%\PrgNewFunction \MathCubic { m }
% {
% \IntSet \lTmpaInt { \IntEval { #1 * #1 * #1 } }
-% \Result { \Value \lTmpaInt }
+% \Return { \Value \lTmpaInt }
% }
%\IgnoreSpacesOff
%\MathCubic{2}
@@ -183,7 +183,7 @@
To make composition of functions work as expected,
every function \emph{must not} insert directly any token to the input stream.
Instead, a function \emph{must} pass the result (if any) to \verb!functional! package
-with \cs{Result} command. And \verb!functional! package is responsible for
+with \cs{Return} command. And \verb!functional! package is responsible for
inserting result tokens to the input stream at the appropriate time.
To remove space tokens inside function code in defining functions,
@@ -198,9 +198,9 @@
\IgnoreSpacesOn
\PrgNewFunction \Fact { m } {
\IntCompareTF {#1} = {0} {
- \Result {1}
+ \Return {1}
}{
- \Result {\IntMathMult{#1}{\Fact{\IntMathSub{#1}{1}}}}
+ \Return {\IntMathMult{#1}{\Fact{\IntMathSub{#1}{1}}}}
}
}
\IgnoreSpacesOff
@@ -225,9 +225,9 @@
%\IgnoreSpacesOn
%\PrgNewFunction \Factorial { m } {
% \IntCompareTF {#1} = {0} {
-% \Result {1}
+% \Return {1}
% }{
-% \Result { \IntMathMult {#1} { \Factorial { \IntMathSub{#1}{1} } } }
+% \Return { \IntMathMult {#1} { \Factorial { \IntMathSub{#1}{1} } } }
% }
%}
%\IgnoreSpacesOff
@@ -349,7 +349,7 @@
% [I] \IntEval{5*5}
% [I] \Expand{\int_eval:n {5*5}}
% [O] 25
-% [I] \Result{25}
+% [I] \Return{25}
% [O] 25
% [O] 25
% [I] \IntSet\lTmpaInt {25}
@@ -356,7 +356,7 @@
% [O]
% [I] \Value\lTmpaInt
% [O] 25
-% [I] \Result{25}
+% [I] \Return{25}
% [O] 25
% [O] 25
%\end{codehigh}
@@ -365,7 +365,7 @@
[I] \IntEval{5*5}
[I] \Expand{\int_eval:n {5*5}}
[O] 25
- [I] \Result{25}
+ [I] \Return{25}
[O] 25
[O] 25
[I] \IntSet{\lTmpaInt }{25}
@@ -372,7 +372,7 @@
[O]
[I] \Value{\lTmpaInt }
[O] 25
- [I] \Result{25}
+ [I] \Return{25}
[O] 25
[O] 25
[I] \MathSquare{25}
@@ -379,7 +379,7 @@
[I] \IntEval{25*25}
[I] \Expand{\int_eval:n {25*25}}
[O] 625
- [I] \Result{625}
+ [I] \Return{625}
[O] 625
[O] 625
[I] \IntSet{\lTmpaInt }{625}
@@ -386,7 +386,7 @@
[O]
[I] \Value{\lTmpaInt }
[O] 625
- [I] \Result{625}
+ [I] \Return{625}
[O] 625
[O] 625
\end{codehigh}
@@ -488,7 +488,7 @@
Creates protected \meta{function} for evaluating the \meta{code}.
Within the \meta{code}, the parameters (\verb|#1|, \verb|#2|,
\emph{etc.}) will be replaced by those absorbed by the function.
-The returned value \emph{must} be passed with \cs{Result} function.
+The returned value \emph{must} be passed with \cs{Return} function.
The definition is global and an error results if the
\meta{function} is already defined.\par
The \Arg{argument specification} in a list of letters,
@@ -513,7 +513,7 @@
\end{syntax}
Creates protected conditional \meta{function} for evaluating the \meta{code}.
The returned value of the \meta{function} \emph{must} be either \verb!\cTrueBool!
-or \verb!\cFalseBool! and be passed with \cs{Result} function..
+or \verb!\cFalseBool! and be passed with \cs{Return} function..
The definition is global and an error results if the \meta{function} is already defined.
\par
Assume the \meta{function} is \verb!\FooIfBar!, then another function \verb!\FooIfBarTF!
@@ -521,14 +521,35 @@
which are \Arg{true code} and \Arg{false code}.\par
\end{function}
-\section{Collecting Returned Values}
+\section{Return Values of Functions}
-\begin{function}{\Result}
+\begin{function}{\Return}
\begin{syntax}
-\cs{Result} \Arg{tokens}
+\cs{Return} \Arg{tokens}
\end{syntax}
-Appends \meta{tokens} to \verb!\gResultTl!, which holds the returned value of current function.
-This function is normally used in the \meta{code} of \cs{PrgNewFunction} and \cs{PrgNewConditional}.
+Returns \meta{tokens} as result of current function or conditional.
+This function is normally used in the \meta{code} of \cs{PrgNewFunction}
+or \cs{PrgNewConditional}, and it \emph{must} be the last function evaluated in the \meta{code}.
+If it is missing, the return value of the last function evaluated in the \meta{code}
+is returned. Therefore, the following two examples produce the same output:
+\begin{codehigh}
+\IgnoreSpacesOn
+\PrgNewFunction \MathSquare { m } {
+ \IntSet \lTmpaInt { \IntEval {#1 * #1} }
+ \Return { \Value \lTmpaInt }
+}
+\IgnoreSpacesOff
+\MathSquare{5}
+\end{codehigh}
+\begin{codehigh}
+\IgnoreSpacesOn
+\PrgNewFunction \MathSquare { m } {
+ \IntSet \lTmpaInt { \IntEval {#1 * #1} }
+ \Value \lTmpaInt
+}
+\IgnoreSpacesOff
+\MathSquare{5}
+\end{codehigh}
\end{function}
\chapter{Argument Using (\texttt{Use})}
@@ -660,8 +681,8 @@
Constants that represent \verb|true| and \verb|false|, respectively. Used to
implement predicates. For example
\begin{demohigh}
-\BoolVarIfTF \cTrueBool {\Result{True!}} {\Result{False!}}
-\BoolVarIfTF \cFalseBool {\Result{True!}} {\Result{False!}}
+\BoolVarIfTF \cTrueBool {\Return{True!}} {\Return{False!}}
+\BoolVarIfTF \cFalseBool {\Return{True!}} {\Return{False!}}
\end{demohigh}
\end{variable}
@@ -776,9 +797,11 @@
\section{Booleans and Conditionals}
-\begin{function}{\BoolIfExist,\BoolIfExistTF}
+\begin{function}{\BoolIfExist,\BoolIfExistT,\BoolIfExistF,\BoolIfExistTF}
\begin{syntax}
\cs{BoolIfExist} \meta{boolean}
+\cs{BoolIfExistT} \meta{boolean} \Arg{true code}
+\cs{BoolIfExistF} \meta{boolean} \Arg{false code}
\cs{BoolIfExistTF} \meta{boolean} \Arg{true code} \Arg{false code}
\end{syntax}
Tests whether the \meta{boolean} is currently defined. This does not
@@ -785,14 +808,16 @@
check that the \meta{boolean} really is a boolean variable.
For example
\begin{demohigh}
-\BoolIfExistTF \lTmpaBool {\Result{Yes}} {\Result{No}}
-\BoolIfExistTF \lFooUndefinedBool {\Result{Yes}} {\Result{No}}
+\BoolIfExistTF \lTmpaBool {\Return{Yes}} {\Return{No}}
+\BoolIfExistTF \lFooUndefinedBool {\Return{Yes}} {\Return{No}}
\end{demohigh}
\end{function}
-\begin{function}{\BoolVarIf,\BoolVarIfTF}
+\begin{function}{\BoolVarIf,\BoolVarIfT,\BoolVarIfF,\BoolVarIfTF}
\begin{syntax}
\cs{BoolVarIf} \meta{boolean}
+\cs{BoolVarIfT} \meta{boolean} \Arg{true code}
+\cs{BoolVarIfF} \meta{boolean} \Arg{false code}
\cs{BoolVarIfTF} \meta{boolean} \Arg{true code} \Arg{false code}
\end{syntax}
Tests the current truth of \meta{boolean}, and continues evaluation
@@ -799,15 +824,17 @@
based on this result. For example
\begin{demohigh}
\BoolSetTrue \lTmpaBool
-\BoolVarIfTF \lTmpaBool {\Result{True!}} {\Result{False!}}
+\BoolVarIfTF \lTmpaBool {\Return{True!}} {\Return{False!}}
\BoolSetFalse \lTmpaBool
-\BoolVarIfTF \lTmpaBool {\Result{True!}} {\Result{False!}}
+\BoolVarIfTF \lTmpaBool {\Return{True!}} {\Return{False!}}
\end{demohigh}
\end{function}
-\begin{function}{\BoolVarNot,\BoolVarNotTF}
+\begin{function}{\BoolVarNot,\BoolVarNotT,\BoolVarNotF,\BoolVarNotTF}
\begin{syntax}
\cs{BoolVarNot} \meta{boolean}
+\cs{BoolVarNotT} \meta{boolean} \Arg{true code}
+\cs{BoolVarNotF} \meta{boolean} \Arg{false code}
\cs{BoolVarNotTF} \meta{boolean} \Arg{true code} \Arg{false code}
\end{syntax}
Evaluates \meta{true code} if \meta{boolean} is \verb!false!,
@@ -814,13 +841,15 @@
and \meta{false code} if \meta{boolean} is \verb!true!.
For example
\begin{demohigh}
-\BoolVarNotTF {\IntCompare{3}>{2}} {\Result{Yes}} {\Result{No}}
+\BoolVarNotTF {\IntCompare{3}>{2}} {\Return{Yes}} {\Return{No}}
\end{demohigh}
\end{function}
-\begin{function}{\BoolVarAnd,\BoolVarAndTF}
+\begin{function}{\BoolVarAnd,\BoolVarAndT,\BoolVarAndF,\BoolVarAndTF}
\begin{syntax}
\cs{BoolVarAnd} \meta{boolean_1} \meta{boolean_2}
+\cs{BoolVarAndT} \meta{boolean_1} \meta{boolean_2} \Arg{true code}
+\cs{BoolVarAndF} \meta{boolean_1} \meta{boolean_2} \Arg{false code}
\cs{BoolVarAndTF} \meta{boolean_1} \meta{boolean_2} \Arg{true code} \Arg{false code}
\end{syntax}
Implements the \enquote{And} operation between two booleans,
@@ -830,13 +859,15 @@
\cs{BoolVarAnd}.
For example
\begin{demohigh}
-\BoolVarAndTF {\IntCompare{3}>{2}} {\IntCompare{3}>{4}} {\Result{Yes}} {\Result{No}}
+\BoolVarAndTF {\IntCompare{3}>{2}} {\IntCompare{3}>{4}} {\Return{Yes}} {\Return{No}}
\end{demohigh}
\end{function}
-\begin{function}{\BoolVarOr,\BoolVarOrTF}
+\begin{function}{\BoolVarOr,\BoolVarOrT,\BoolVarOrF,\BoolVarOrTF}
\begin{syntax}
\cs{BoolVarOr} \meta{boolean_1} \meta{boolean_2}
+\cs{BoolVarOrT} \meta{boolean_1} \meta{boolean_2} \Arg{true code}
+\cs{BoolVarOrF} \meta{boolean_1} \meta{boolean_2} \Arg{false code}
\cs{BoolVarOrTF} \meta{boolean_1} \meta{boolean_2} \Arg{true code} \Arg{false code}
\end{syntax}
Implements the \enquote{Or} operation between two booleans,
@@ -846,22 +877,124 @@
\cs{BoolVarOr}.
For example
\begin{demohigh}
-\BoolVarOrTF {\IntCompare{3}>{2}} {\IntCompare{3}>{4}} {\Result{Yes}} {\Result{No}}
+\BoolVarOrTF {\IntCompare{3}>{2}} {\IntCompare{3}>{4}} {\Return{Yes}} {\Return{No}}
\end{demohigh}
\end{function}
-\begin{function}{\BoolVarXor,\BoolVarXorTF}
+\begin{function}{\BoolVarXor,\BoolVarXorT,\BoolVarXorF,\BoolVarXorTF}
\begin{syntax}
\cs{BoolVarXor} \meta{boolean_1} \meta{boolean_2}
+\cs{BoolVarXorT} \meta{boolean_1} \meta{boolean_2} \Arg{true code}
+\cs{BoolVarXorF} \meta{boolean_1} \meta{boolean_2} \Arg{false code}
\cs{BoolVarXorTF} \meta{boolean_1} \meta{boolean_2} \Arg{true code} \Arg{false code}
\end{syntax}
Implements an \enquote{exclusive or} operation between two booleans.
For example
\begin{demohigh}
-\BoolVarXorTF {\IntCompare{3}>{2}} {\IntCompare{3}>{4}} {\Result{Yes}} {\Result{No}}
+\BoolVarXorTF {\IntCompare{3}>{2}} {\IntCompare{3}>{4}} {\Return{Yes}} {\Return{No}}
\end{demohigh}
\end{function}
+\section{Booleans and Logical Loops}
+
+Loops using either boolean expressions or stored boolean values.
+
+\begin{function}{\BoolDoUntil}
+\begin{syntax}
+\cs{BoolDoUntil} \meta{boolean} \Arg{code}
+\end{syntax}
+Places the \meta{code} in the input stream for \TeX{} to process,
+and then checks the logical value of the \meta{boolean}. If it is
+\texttt{false} then the \meta{code} is inserted into the input
+stream again and the process loops until the \meta{boolean} is
+\texttt{true}.
+\begin{demohigh}
+\IgnoreSpacesOn
+\BoolSetFalse \lTmpaBool
+\IntZero \lTmpaInt
+\ClistClear \lTmpaClist
+\BoolVarDoUntil \lTmpaBool {
+ \IntIncr \lTmpaInt
+ \ClistPutRight \lTmpaClist {\Value\lTmpaInt}
+ \IntCompareT {\lTmpaInt} = {10} {\BoolSetTrue \lTmpaBool}
+}
+\ClistVarJoin \lTmpaClist {:}
+\IgnoreSpacesOff
+\end{demohigh}
+\end{function}
+
+\begin{function}{\BoolDoWhile}
+\begin{syntax}
+\cs{BoolDoWhile} \meta{boolean} \Arg{code}
+\end{syntax}
+Places the \meta{code} in the input stream for \TeX{} to process,
+and then checks the logical value of the \meta{boolean}. If it is
+\texttt{true} then the \meta{code} is inserted into the input
+stream again and the process loops until the \meta{boolean} is
+\texttt{false}.
+\begin{demohigh}
+\IgnoreSpacesOn
+\BoolSetTrue \lTmpaBool
+\IntZero \lTmpaInt
+\ClistClear \lTmpaClist
+\BoolVarDoWhile \lTmpaBool {
+ \IntIncr \lTmpaInt
+ \ClistPutRight \lTmpaClist {\Value\lTmpaInt}
+ \IntCompareT {\lTmpaInt} = {10} {\BoolSetFalse \lTmpaBool}
+}
+\ClistVarJoin \lTmpaClist {:}
+\IgnoreSpacesOff
+\end{demohigh}
+\end{function}
+
+\begin{function}{\BoolUntilDo}
+\begin{syntax}
+\cs{BoolUntilDo} \meta{boolean} \Arg{code}
+\end{syntax}
+This function firsts checks the logical value of the \meta{boolean}.
+If it is \texttt{false} the \meta{code} is placed in the input stream
+and expanded. After the completion of the \meta{code} the truth
+of the \meta{boolean} is re-evaluated. The process then loops
+until the \meta{boolean} is \texttt{true}.
+\begin{demohigh}
+\IgnoreSpacesOn
+\BoolSetFalse \lTmpaBool
+\IntZero \lTmpaInt
+\ClistClear \lTmpaClist
+\BoolVarUntilDo \lTmpaBool {
+ \IntIncr \lTmpaInt
+ \ClistPutRight \lTmpaClist {\Value\lTmpaInt}
+ \IntCompareT {\lTmpaInt} = {10} {\BoolSetTrue \lTmpaBool}
+}
+\ClistVarJoin \lTmpaClist {:}
+\IgnoreSpacesOff
+\end{demohigh}
+\end{function}
+
+\begin{function}{\BoolWhileDo}
+\begin{syntax}
+\cs{BoolWhileDo} \meta{boolean} \Arg{code}
+\end{syntax}
+This function firsts checks the logical value of the \meta{boolean}.
+If it is \texttt{true} the \meta{code} is placed in the input stream
+and expanded. After the completion of the \meta{code} the truth
+of the \meta{boolean} is re-evaluated. The process then loops
+until the \meta{boolean} is \texttt{false}.
+\begin{demohigh}
+\IgnoreSpacesOn
+\BoolSetTrue \lTmpaBool
+\IntZero \lTmpaInt
+\ClistClear \lTmpaClist
+\BoolVarWhileDo \lTmpaBool {
+ \IntIncr \lTmpaInt
+ \ClistPutRight \lTmpaClist {\Value\lTmpaInt}
+ \IntCompareT {\lTmpaInt} = {10} {\BoolSetFalse \lTmpaBool}
+}
+\ClistVarJoin \lTmpaClist {:}
+\IgnoreSpacesOff
+\end{demohigh}
+\end{function}
+
\chapter{Token Lists (\texttt{Tl})}
\TeX{} works with tokens, and \LaTeX3 therefore provides a number of
@@ -920,7 +1053,7 @@
%will \emph{not} match the simple text input \verb|-NoValue-|, \emph{i.e.}
%that
%\begin{demohigh}
-%\TlIfEqTF {\TlUse\cNoValueTl} {-NoValue-} {Result{Yes}} {\Result{No}}
+%\TlIfEqTF {\TlUse\cNoValueTl} {-NoValue-} {Result{Yes}} {\Return{No}}
%\end{demohigh}
%The \cs{cNoValueTl} marker is intended for
%use in creating document-level interfaces, where it serves as an indicator
@@ -1478,7 +1611,7 @@
\TlMapInline {one} {
\TlPutRight \lTmpaTl {[#1]}
}
-\Result{\TlUse\lTmpaTl}
+\Return{\TlUse\lTmpaTl}
\IgnoreSpacesOff
\end{codehigh}
produces [o][n][e].
@@ -1498,7 +1631,7 @@
\TlVarMapInline \lTmpkTl {
\TlPutRight \lTmpaTl {[#1]}
}
-\Result{\TlUse\lTmpaTl}
+\Return{\TlUse\lTmpaTl}
\IgnoreSpacesOff
\end{codehigh}
produces [o][n][e].
@@ -1538,7 +1671,7 @@
\TlMapVariable {one} \lTmpiTl {
\TlPutRight \lTmpaTl {\Expand {[\lTmpiTl]}}
}
-\Result{\TlUse\lTmpaTl}
+\Return{\TlUse\lTmpaTl}
\IgnoreSpacesOff
\end{demohigh}
\end{function}
@@ -1560,7 +1693,7 @@
\TlVarMapVariable \lTmpkTl \lTmpiTl {
\TlPutRight \lTmpaTl {\Expand {[\lTmpiTl]}}
}
-\Result{\TlUse\lTmpaTl}
+\Return{\TlUse\lTmpaTl}
\IgnoreSpacesOff
\end{demohigh}
\end{function}
@@ -1618,35 +1751,41 @@
\section{Token List Conditionals}
-\begin{function}{\TlIfExist,\TlIfExistTF}
+\begin{function}{\TlIfExist,\TlIfExistT,\TlIfExistF,\TlIfExistTF}
\begin{syntax}
\cs{TlIfExist} \meta{tl var}
+\cs{TlIfExistT} \meta{tl var} \Arg{true code}
+\cs{TlIfExistF} \meta{tl var} \Arg{false code}
\cs{TlIfExistTF} \meta{tl var} \Arg{true code} \Arg{false code}
\end{syntax}
Tests whether the \meta{tl var} is currently defined. This does not
check that the \meta{tl var} really is a token list variable.
\begin{demohigh}
-\TlIfExistTF \lTmpaTl {\Result{Yes}} {\Result{No}}
-\TlIfExistTF \lFooUndefinedTl {\Result{Yes}} {\Result{No}}
+\TlIfExistTF \lTmpaTl {\Return{Yes}} {\Return{No}}
+\TlIfExistTF \lFooUndefinedTl {\Return{Yes}} {\Return{No}}
\end{demohigh}
\end{function}
-\begin{function}{\TlIfEmpty,\TlIfEmptyTF}
+\begin{function}{\TlIfEmpty,\TlIfEmptyT,\TlIfEmptyF,\TlIfEmptyTF}
\begin{syntax}
\cs{TlIfEmpty} \Arg{token list}
+\cs{TlIfEmptyT} \Arg{token list} \Arg{true code}
+\cs{TlIfEmptyF} \Arg{token list} \Arg{false code}
\cs{TlIfEmptyTF} \Arg{token list} \Arg{true code} \Arg{false code}
\end{syntax}
Tests if the \meta{token list} is entirely empty
(\emph{i.e.}~contains no tokens at all). For example
\begin{demohigh}
-\TlIfEmptyTF {abc} {\Result{Empty}} {\Result{NonEmpty}}
-\TlIfEmptyTF {} {\Result{Empty}} {\Result{NonEmpty}}
+\TlIfEmptyTF {abc} {\Return{Empty}} {\Return{NonEmpty}}
+\TlIfEmptyTF {} {\Return{Empty}} {\Return{NonEmpty}}
\end{demohigh}
\end{function}
-\begin{function}{\TlVarIfEmpty,\TlVarIfEmptyTF}
+\begin{function}{\TlVarIfEmpty,\TlVarIfEmptyT,\TlVarIfEmptyF,\TlVarIfEmptyTF}
\begin{syntax}
\cs{TlVarIfEmpty} \meta{tl~var}
+\cs{TlVarIfEmptyT} \meta{tl~var} \Arg{true code}
+\cs{TlVarIfEmptyF} \meta{tl~var} \Arg{false code}
\cs{TlVarIfEmptyTF} \meta{tl~var} \Arg{true code} \Arg{false code}
\end{syntax}
Tests if the \meta{token list variable} is entirely empty
@@ -1653,15 +1792,17 @@
(\emph{i.e.}~contains no tokens at all). For example
\begin{demohigh}
\TlSet \lTmpaTl {abc}
-\TlVarIfEmptyTF \lTmpaTl {\Result{Empty}} {\Result{NonEmpty}}
+\TlVarIfEmptyTF \lTmpaTl {\Return{Empty}} {\Return{NonEmpty}}
\TlClear \lTmpaTl
-\TlVarIfEmptyTF \lTmpaTl {\Result{Empty}} {\Result{NonEmpty}}
+\TlVarIfEmptyTF \lTmpaTl {\Return{Empty}} {\Return{NonEmpty}}
\end{demohigh}
\end{function}
-\begin{function}{\TlIfBlank}
+\begin{function}{\TlIfBlank,\TlIfBlankT,\TlIfBlankF,\TlIfBlankTF}
\begin{syntax}
\cs{TlIfBlank} \Arg{token list}
+\cs{TlIfBlankT} \Arg{token list} \Arg{true code}
+\cs{TlIfBlankF} \Arg{token list} \Arg{false code}
\cs{TlIfBlankTF} \Arg{token list} \Arg{true code} \Arg{false code}
\end{syntax}
Tests if the \meta{token list} consists only of blank spaces
@@ -1670,14 +1811,16 @@
(explicit tokens with character code $32$ and category code $10$),
and is \texttt{false} otherwise.
\begin{demohigh}
-\TlIfEmptyTF { } {\Result{Yes}} {\Result{No}}
-\TlIfBlankTF { } {\Result{Yes}} {\Result{No}}
+\TlIfEmptyTF { } {\Return{Yes}} {\Return{No}}
+\TlIfBlankTF { } {\Return{Yes}} {\Return{No}}
\end{demohigh}
\end{function}
-\begin{function}{\TlIfEq,\TlIfEqTF}
+\begin{function}{\TlIfEq,\TlIfEqT,\TlIfEqF,\TlIfEqTF}
\begin{syntax}
\cs{TlIfEq} \Arg{token list_1} \Arg{token list_2}
+\cs{TlIfEqT} \Arg{token list_1} \Arg{token list_2} \Arg{true code}
+\cs{TlIfEqF} \Arg{token list_1} \Arg{token list_2} \Arg{false code}
\cs{TlIfEqTF} \Arg{token list_1} \Arg{token list_2} \Arg{true code} \Arg{false code}
\end{syntax}
Tests if \meta{token list_1} and \meta{token list_2} contain the
@@ -1685,21 +1828,23 @@
codes. See \cs{StrIfEq} if category codes are not important.
For example
\begin{demohigh}
-\TlIfEqTF {abc} {abc} {\Result{Yes}} {\Result{No}}
-\TlIfEqTF {abc} {xyz} {\Result{Yes}} {\Result{No}}
+\TlIfEqTF {abc} {abc} {\Return{Yes}} {\Return{No}}
+\TlIfEqTF {abc} {xyz} {\Return{Yes}} {\Return{No}}
\end{demohigh}
%\begin{demohigh}
%\TlSet\lTmpaTl{abc}
%\TlSet\lTmpbTl{abc}
%\TlSet\lTmpcTl{xyz}
-%\TlIfEqTF{\TlUse\lTmpaTl}{\TlUse\lTmpbTl}{\Result{Yes}}{\Result{No}}
-%\TlIfEqTF{\TlUse\lTmpaTl}{\TlUse\lTmpcTl}{\Result{Yes}}{\Result{No}}
+%\TlIfEqTF{\TlUse\lTmpaTl}{\TlUse\lTmpbTl}{\Return{Yes}}{\Return{No}}
+%\TlIfEqTF{\TlUse\lTmpaTl}{\TlUse\lTmpcTl}{\Return{Yes}}{\Return{No}}
%\end{demohigh}
\end{function}
-\begin{function}{\TlVarIfEq,\TlVarIfEqTF}
+\begin{function}{\TlVarIfEq,\TlVarIfEqT,\TlVarIfEqF,\TlVarIfEqTF}
\begin{syntax}
\cs{TlVarIfEq} \meta{tl var_1} \meta{tl var_2}
+\cs{TlVarIfEqT} \meta{tl var_1} \meta{tl var_2} \Arg{true code}
+\cs{TlVarIfEqF} \meta{tl var_1} \meta{tl var_2} \Arg{false code}
\cs{TlVarIfEqTF} \meta{tl var_1} \meta{tl var_2} \Arg{true code} \Arg{false code}
\end{syntax}
Compares the content of two \meta{token list variables} and
@@ -1710,15 +1855,17 @@
\TlSet \lTmpaTl {abc}
\TlSet \lTmpbTl {abc}
\TlSet \lTmpcTl {xyz}
-\TlVarIfEqTF \lTmpaTl \lTmpbTl {\Result{Yes}} {\Result{No}}
-\TlVarIfEqTF \lTmpaTl \lTmpcTl {\Result{Yes}} {\Result{No}}
+\TlVarIfEqTF \lTmpaTl \lTmpbTl {\Return{Yes}} {\Return{No}}
+\TlVarIfEqTF \lTmpaTl \lTmpcTl {\Return{Yes}} {\Return{No}}
\end{demohigh}
See also \cs{StrVarIfEq} for a comparison that ignores category codes.
\end{function}
-\begin{function}{\TlIfIn,\TlIfInTF}
+\begin{function}{\TlIfIn,\TlIfInT,\TlIfInF,\TlIfInTF}
\begin{syntax}
\cs{TlIfIn} \Arg{token list_1} \Arg{token list_2}
+\cs{TlIfInT} \Arg{token list_1} \Arg{token list_2} \Arg{true code}
+\cs{TlIfInF} \Arg{token list_1} \Arg{token list_2} \Arg{false code}
\cs{TlIfInTF} \Arg{token list_1} \Arg{token list_2} \Arg{true code} \Arg{false code}
\end{syntax}
Tests if \meta{token list_2} is found inside \meta{token list_1}.
@@ -1727,14 +1874,16 @@
(begin-group) or $2$ (end-group), and tokens with category code $6$).
The search does \emph{not} enter brace (category code $1$/$2$) groups.
\begin{demohigh}
-\TlIfInTF {hello world} {o} {\Result{Yes}} {\Result{No}}
-\TlIfInTF {hello world} {a} {\Result{Yes}} {\Result{No}}
+\TlIfInTF {hello world} {o} {\Return{Yes}} {\Return{No}}
+\TlIfInTF {hello world} {a} {\Return{Yes}} {\Return{No}}
\end{demohigh}
\end{function}
-\begin{function}{\TlVarIfIn,\TlVarIfInTF}
+\begin{function}{\TlVarIfIn,\TlVarIfInT,\TlVarIfInF,\TlVarIfInTF}
\begin{syntax}
\cs{TlVarIfIn} \meta{tl var} \Arg{token list}
+\cs{TlVarIfInT} \meta{tl var} \Arg{token list} \Arg{true code}
+\cs{TlVarIfInF} \meta{tl var} \Arg{token list} \Arg{false code}
\cs{TlVarIfInTF} \meta{tl var} \Arg{token list} \Arg{true code} \Arg{false code}
\end{syntax}
Tests if the \meta{token list} is found in the content of the
@@ -1744,14 +1893,16 @@
(begin-group) or $2$ (end-group), and tokens with category code $6$).
\begin{demohigh}
\TlSet \lTmpaTl {hello world}
-\TlVarIfInTF \lTmpaTl {o} {\Result{Yes}} {\Result{No}}
-\TlVarIfInTF \lTmpaTl {a} {\Result{Yes}} {\Result{No}}
+\TlVarIfInTF \lTmpaTl {o} {\Return{Yes}} {\Return{No}}
+\TlVarIfInTF \lTmpaTl {a} {\Return{Yes}} {\Return{No}}
\end{demohigh}
\end{function}
-\begin{function}{\TlIfSingle,\TlIfSingleTF}
+\begin{function}{\TlIfSingle,\TlIfSingleT,\TlIfSingleF,\TlIfSingleTF}
\begin{syntax}
\cs{TlIfSingle} \Arg{token list}
+\cs{TlIfSingleT} \Arg{token list} \Arg{true code}
+\cs{TlIfSingleF} \Arg{token list} \Arg{false code}
\cs{TlIfSingleTF} \Arg{token list} \Arg{true code} \Arg{false code}
\end{syntax}
Tests if the \meta{token list} has exactly one \meta{item}, \emph{i.e.} is
@@ -1760,14 +1911,16 @@
optional spaces on both sides. In other words, such a token list has
token count $1$ according to \cs{TlCount}.
\begin{demohigh}
-\TlIfSingleTF {a} {\Result{Yes}} {\Result{No}}
-\TlIfSingleTF {abc} {\Result{Yes}} {\Result{No}}
+\TlIfSingleTF {a} {\Return{Yes}} {\Return{No}}
+\TlIfSingleTF {abc} {\Return{Yes}} {\Return{No}}
\end{demohigh}
\end{function}
-\begin{function}{\TlVarIfSingle,\TlVarIfSingleTF}
+\begin{function}{\TlVarIfSingle,\TlVarIfSingleT,\TlVarIfSingleF,\TlVarIfSingleTF}
\begin{syntax}
\cs{TlVarIfSingle} \meta{tl var}
+\cs{TlVarIfSingleT} \meta{tl var} \Arg{true code}
+\cs{TlVarIfSingleF} \meta{tl var} \Arg{false code}
\cs{TlVarIfSingleTF} \meta{tl var} \Arg{true code} \Arg{false code}
\end{syntax}
Tests if the content of the \meta{tl var} consists of a single \meta{item},
@@ -1777,9 +1930,9 @@
token list has token count $1$ according to \cs{TlVarCount}.
\begin{demohigh}
\TlSet \lTmpaTl {a}
-\TlVarIfSingleTF \lTmpaTl {\Result{Yes}} {\Result{No}}
+\TlVarIfSingleTF \lTmpaTl {\Return{Yes}} {\Return{No}}
\TlSet \lTmpaTl {abc}
-\TlVarIfSingleTF \lTmpaTl {\Result{Yes}} {\Result{No}}
+\TlVarIfSingleTF \lTmpaTl {\Return{Yes}} {\Return{No}}
\end{demohigh}
\end{function}
@@ -1808,9 +1961,9 @@
\TlSet \lTmpcTl {c}
\TlSet \lTmpkTl {b}
\TlVarCase \lTmpkTl {
- \lTmpaTl {\Result {First}}
- \lTmpbTl {\Result {Second}}
- \lTmpcTl {\Result {Third}}
+ \lTmpaTl {\Return {First}}
+ \lTmpbTl {\Return {Second}}
+ \lTmpcTl {\Return {Third}}
}
\IgnoreSpacesOff
\end{demohigh}
@@ -1845,7 +1998,7 @@
\lTmpbTl {\IntSet \lTmpkInt {2}}
\lTmpcTl {\IntSet \lTmpkInt {3}}
}{
- \Result {\IntUse \lTmpkInt}
+ \Return {\IntUse \lTmpkInt}
}
\IgnoreSpacesOff
\end{demohigh}
@@ -1875,11 +2028,11 @@
\TlSet \lTmpcTl {c}
\TlSet \lTmpkTl {b}
\TlVarCaseF \lTmpkTl{
- \lTmpaTl {\Result {First}}
- \lTmpbTl {\Result {Second}}
- \lTmpcTl {\Result {Third}}
+ \lTmpaTl {\Return {First}}
+ \lTmpbTl {\Return {Second}}
+ \lTmpcTl {\Return {Third}}
}{
- \Result {No~Match!}
+ \Return {No~Match!}
}
\IgnoreSpacesOff
\end{demohigh}
@@ -1917,9 +2070,9 @@
\lTmpbTl {\IntSet \lTmpkInt {2}}
\lTmpcTl {\IntSet \lTmpkInt {3}}
}{
- \Result {\IntUse \lTmpkInt}
+ \Return {\IntUse \lTmpkInt}
}{
- \Result {0}
+ \Return {0}
}
\IgnoreSpacesOff
\end{demohigh}
@@ -2376,7 +2529,7 @@
\StrMapInline {one} {
\StrPutRight \lTmpaStr {[#1]}
}
-\Result{\StrUse\lTmpaStr}
+\Return{\StrUse\lTmpaStr}
\IgnoreSpacesOff
\end{codehigh}
produces [o][n][e].
@@ -2413,7 +2566,7 @@
\StrMapVariable {one} \lTmpiStr {
\StrPutRight \lTmpaStr {\Expand {[\lTmpiStr]}}
}
-\Result{\StrUse\lTmpaStr}
+\Return{\StrUse\lTmpaStr}
\IgnoreSpacesOff
\end{demohigh}
\end{function}
@@ -2471,22 +2624,26 @@
\section{String Conditionals}
-\begin{function}{\StrIfExist,\StrIfExistTF}
+\begin{function}{\StrIfExist,\StrIfExistT,\StrIfExistF,\StrIfExistTF}
\begin{syntax}
\cs{StrIfExist} \meta{str var}
+\cs{StrIfExistT} \meta{str var} \Arg{true code}
+\cs{StrIfExistF} \meta{str var} \Arg{false code}
\cs{StrIfExistTF} \meta{str var} \Arg{true code} \Arg{false code}
\end{syntax}
Tests whether the \meta{str var} is currently defined. This does not
check that the \meta{str var} really is a string.
\begin{demohigh}
-\StrIfExistTF\lTmpaStr{\Result{Yes}}{\Result{No}}
-\StrIfExistTF\lFooUndefinedStr{\Result{Yes}}{\Result{No}}
+\StrIfExistTF \lTmpaStr {\Return{Yes}} {\Return{No}}
+\StrIfExistTF \lFooUndefinedStr {\Return{Yes}} {\Return{No}}
\end{demohigh}
\end{function}
-\begin{function}{\StrVarIfEmpty,\StrVarIfEmptyTF}
+\begin{function}{\StrVarIfEmpty,\StrVarIfEmptyT,\StrVarIfEmptyF,\StrVarIfEmptyTF}
\begin{syntax}
\cs{StrVarIfEmpty} \meta{str var}
+\cs{StrVarIfEmptyT} \meta{str var} \Arg{true code}
+\cs{StrVarIfEmptyF} \meta{str var} \Arg{false code}
\cs{StrVarIfEmptyTF} \meta{str var} \Arg{true code} \Arg{false code}
\end{syntax}
Tests if the \meta{string variable} is entirely empty
@@ -2493,15 +2650,17 @@
(\emph{i.e.} contains no characters at all).
\begin{demohigh}
\StrSet \lTmpaStr {abc}
-\StrVarIfEmptyTF \lTmpaStr {\Result{Empty}} {\Result{NonEmpty}}
+\StrVarIfEmptyTF \lTmpaStr {\Return{Empty}} {\Return{NonEmpty}}
\StrClear \lTmpaStr
-\StrVarIfEmptyTF \lTmpaStr {\Result{Empty}} {\Result{NonEmpty}}
+\StrVarIfEmptyTF \lTmpaStr {\Return{Empty}} {\Return{NonEmpty}}
\end{demohigh}
\end{function}
-\begin{function}{\StrIfEq,\StrIfEqTF}
+\begin{function}{\StrIfEq,\StrIfEqT,\StrIfEqF,\StrIfEqTF}
\begin{syntax}
\cs{StrIfEq} \Arg{tl_1} \Arg{tl_2}
+\cs{StrIfEqT} \Arg{tl_1} \Arg{tl_2} \Arg{true code}
+\cs{StrIfEqF} \Arg{tl_1} \Arg{tl_2} \Arg{false code}
\cs{StrIfEqTF} \Arg{tl_1} \Arg{tl_2} \Arg{true code} \Arg{false code}
\end{syntax}
Compares the two \meta{token lists} on a character by character
@@ -2517,23 +2676,25 @@
tokens (including their category codes) rather than characters.
For example
\begin{demohigh}
-\StrIfEqTF {abc} {abc} {\Result{Yes}} {\Result{No}}
-\StrIfEqTF {abc} {xyz} {\Result{Yes}} {\Result{No}}
+\StrIfEqTF {abc} {abc} {\Return{Yes}} {\Return{No}}
+\StrIfEqTF {abc} {xyz} {\Return{Yes}} {\Return{No}}
\end{demohigh}
%\begin{demohigh}
%\StrSet\lTmpaStr{abc}
%\StrSet\lTmpbStr{abc}
%\StrSet\lTmpcStr{xyz}
-%\StrIfEqTF{\lTmpaStr}{\lTmpbStr}{\Result{Yes}}{\Result{No}}
-%\StrIfEqTF{\lTmpaStr}{\lTmpcStr}{\Result{Yes}}{\Result{No}}
-%\StrIfEqTF{\StrUse\lTmpaStr}{\StrUse\lTmpbStr}{\Result{Yes}}{\Result{No}}
-%\StrIfEqTF{\StrUse\lTmpaStr}{\StrUse\lTmpcStr}{\Result{Yes}}{\Result{No}}
+%\StrIfEqTF{\lTmpaStr}{\lTmpbStr}{\Return{Yes}}{\Return{No}}
+%\StrIfEqTF{\lTmpaStr}{\lTmpcStr}{\Return{Yes}}{\Return{No}}
+%\StrIfEqTF{\StrUse\lTmpaStr}{\StrUse\lTmpbStr}{\Return{Yes}}{\Return{No}}
+%\StrIfEqTF{\StrUse\lTmpaStr}{\StrUse\lTmpcStr}{\Return{Yes}}{\Return{No}}
%\end{demohigh}
\end{function}
-\begin{function}{\StrVarIfEq,\StrVarIfEqTF}
+\begin{function}{\StrVarIfEq,\StrVarIfEqT,\StrVarIfEqF,\StrVarIfEqTF}
\begin{syntax}
\cs{StrVarIfEq} \meta{str var_1} \meta{str var_2}
+\cs{StrVarIfEqT} \meta{str var_1} \meta{str var_2} \Arg{true code}
+\cs{StrVarIfEqF} \meta{str var_1} \meta{str var_2} \Arg{false code}
\cs{StrVarIfEqTF} \meta{str var_1} \meta{str var_2} \Arg{true code} \Arg{false code}
\end{syntax}
Compares the content of two \meta{str variables} and
@@ -2544,27 +2705,31 @@
\StrSet \lTmpaStr {abc}
\StrSet \lTmpbStr {abc}
\StrSet \lTmpcStr {xyz}
-\StrVarIfEqTF \lTmpaStr \lTmpbStr {\Result{Yes}} {\Result{No}}
-\StrVarIfEqTF \lTmpaStr \lTmpcStr {\Result{Yes}} {\Result{No}}
+\StrVarIfEqTF \lTmpaStr \lTmpbStr {\Return{Yes}} {\Return{No}}
+\StrVarIfEqTF \lTmpaStr \lTmpcStr {\Return{Yes}} {\Return{No}}
\end{demohigh}
\end{function}
-\begin{function}{\StrIfIn,\StrIfInTF}
+\begin{function}{\StrIfIn,\StrIfInT,\StrIfInF,\StrIfInTF}
\begin{syntax}
-\cs{StrIfInTF} \Arg{tl_1} \Arg{tl_2}
+\cs{StrIfIn} \Arg{tl_1} \Arg{tl_2}
+\cs{StrIfInT} \Arg{tl_1} \Arg{tl_2} \Arg{true code}
+\cs{StrIfInF} \Arg{tl_1} \Arg{tl_2} \Arg{false code}
\cs{StrIfInTF} \Arg{tl_1} \Arg{tl_2} \Arg{true code} \Arg{false code}
\end{syntax}
Converts both \meta{token lists} to \meta{strings} and
tests whether \meta{string_2} is found inside \meta{string_1}.
\begin{demohigh}
-\StrIfInTF {hello world} {o} {\Result{Yes}}{\Result{No}}
-\StrIfInTF {hello world} {a} {\Result{Yes}}{\Result{No}}
+\StrIfInTF {hello world} {o} {\Return{Yes}}{\Return{No}}
+\StrIfInTF {hello world} {a} {\Return{Yes}}{\Return{No}}
\end{demohigh}
\end{function}
-\begin{function}{\StrVarIfIn,\StrVarIfInTF}
+\begin{function}{\StrVarIfIn,\StrVarIfInT,\StrVarIfInF,\StrVarIfInTF}
\begin{syntax}
-\cs{StrVarIfInTF} \meta{str var} \Arg{token list}
+\cs{StrVarIfIn} \meta{str var} \Arg{token list}
+\cs{StrVarIfInT} \meta{str var} \Arg{token list} \Arg{true code}
+\cs{StrVarIfInF} \meta{str var} \Arg{token list} \Arg{false code}
\cs{StrVarIfInTF} \meta{str var} \Arg{token list} \Arg{true code} \Arg{false code}
\end{syntax}
Converts the \meta{token list} to a \meta{string} and
@@ -2571,14 +2736,16 @@
tests if that \meta{string} is found in the content of the \meta{str var}.
\begin{demohigh}
\StrSet \lTmpaStr {hello world}
-\StrVarIfInTF \lTmpaStr {o} {\Result{Yes}}{\Result{No}}
-\StrVarIfInTF \lTmpaStr {a} {\Result{Yes}}{\Result{No}}
+\StrVarIfInTF \lTmpaStr {o} {\Return{Yes}}{\Return{No}}
+\StrVarIfInTF \lTmpaStr {a} {\Return{Yes}}{\Return{No}}
\end{demohigh}
\end{function}
-\begin{function}{\StrCompare,\StrCompareTF}
+\begin{function}{\StrCompare,\StrCompareT,\StrCompareF,\StrCompareTF}
\begin{syntax}
\cs{StrCompare} \Arg{tl_1} \meta{relation} \Arg{tl_2}
+\cs{StrCompareT} \Arg{tl_1} \meta{relation} \Arg{tl_2} \Arg{true code}
+\cs{StrCompareF} \Arg{tl_1} \meta{relation} \Arg{tl_2} \Arg{false code}
\cs{StrCompareTF} \Arg{tl_1} \meta{relation} \Arg{tl_2} \Arg{true code} \Arg{false code}
\end{syntax}
Compares the two \meta{token lists} on a character by character
@@ -2593,8 +2760,8 @@
\end{itemize}
For example:
\begin{demohigh}
-\StrCompareTF {ab} < {abc} {\Result{Yes}} {\Result{No}}
-\StrCompareTF {ab} < {aa} {\Result{Yes}} {\Result{No}}
+\StrCompareTF {ab} < {abc} {\Return{Yes}} {\Return{No}}
+\StrCompareTF {ab} < {aa} {\Return{Yes}} {\Return{No}}
\end{demohigh}
%\begin{texnote}
%This is a wrapper around the \TeX{} primitive
@@ -2628,9 +2795,9 @@
\begin{demohigh}
\IgnoreSpacesOn
\StrCase {bbb} {
- {aaa} {\Result{First}}
- {bbb} {\Result{Second}}
- {ccb} {\Result{Third}}
+ {aaa} {\Return{First}}
+ {bbb} {\Return{Second}}
+ {ccb} {\Return{Third}}
}
\IgnoreSpacesOff
\end{demohigh}
@@ -2661,7 +2828,7 @@
{bbb} {\TlSet\lTmpkTl{Second}}
{ccb} {\TlSet\lTmpkTl{Third}}
}{
- \Result{\TlUse\lTmpkTl}
+ \Return{\TlUse\lTmpkTl}
}
\IgnoreSpacesOff
\end{demohigh}
@@ -2687,11 +2854,11 @@
\begin{demohigh}
\IgnoreSpacesOn
\StrCaseF {bbb} {
- {aaa} {\Result{First}}
- {bbb} {\Result{Second}}
- {ccb} {\Result{Third}}
+ {aaa} {\Return{First}}
+ {bbb} {\Return{Second}}
+ {ccb} {\Return{Third}}
}{
- \Result{No~Match!}
+ \Return{No~Match!}
}
\IgnoreSpacesOff
\end{demohigh}
@@ -2724,9 +2891,9 @@
{bbb} {\TlSet\lTmpkTl{Second}}
{ccb} {\TlSet\lTmpkTl{Third}}
}{
- \Result{\TlUse\lTmpkTl}
+ \Return{\TlUse\lTmpkTl}
}{
- \Result{No~Match!}
+ \Return{No~Match!}
}
\IgnoreSpacesOff
\end{demohigh}
@@ -3102,7 +3269,7 @@
\IntStepInline {1} {3} {30} {
\TlPutRight \lTmpaTl {[#1]}
}
-\Result {\Value\lTmpaTl}
+\Return {\Value\lTmpaTl}
\IgnoreSpacesOff
\end{codehigh}
produces [1][4][7][10][13][16][19][22][25][28].
@@ -3127,7 +3294,7 @@
% \TlPutRight\lTmpaTl{\Value\lTmpiTl}
% \TlPutRight\lTmpaTl{~}
%}
-%\Result{\Value\lTmpaTl}
+%\Return{\Value\lTmpaTl}
%\IgnoreSpacesOff
%\end{demohigh}
\end{function}
@@ -3134,9 +3301,11 @@
\section{Integer Conditionals}
-\begin{function}{\IntIfExist, \IntIfExistTF}
+\begin{function}{\IntIfExist,\IntIfExistT,\IntIfExistF,\IntIfExistTF}
\begin{syntax}
\cs{IntIfExist} \meta{integer}
+\cs{IntIfExistT} \meta{integer} \Arg{true code}
+\cs{IntIfExistF} \meta{integer} \Arg{false code}
\cs{IntIfExistTF} \meta{integer} \Arg{true code} \Arg{false code}
\end{syntax}
Tests whether the \meta{integer} is currently defined. This does not
@@ -3143,9 +3312,11 @@
check that the \meta{integer} really is an integer variable.
\end{function}
-\begin{function}{\IntIfOdd,\IntIfOddTF}
+\begin{function}{\IntIfOdd,\IntIfOddT,\IntIfOddF,\IntIfOddTF}
\begin{syntax}
\cs{IntIfOdd} \Arg{integer expression}
+\cs{IntIfOddT} \Arg{integer expression} \Arg{true code}
+\cs{IntIfOddF} \Arg{integer expression} \Arg{false code}
\cs{IntIfOddTF} \Arg{integer expression} \Arg{true code} \Arg{false code}
\end{syntax}
This function first evaluates the \meta{integer expression}
@@ -3153,9 +3324,11 @@
It then evaluates if this is odd or even, as appropriate.
\end{function}
-\begin{function}{\IntIfEven,\IntIfEvenTF}
+\begin{function}{\IntIfEven,\IntIfEvenT,\IntIfEvenF,\IntIfEvenTF}
\begin{syntax}
\cs{IntIfEven} \Arg{integer expression}
+\cs{IntIfEvenT} \Arg{integer expression} \Arg{true code}
+\cs{IntIfEvenF} \Arg{integer expression} \Arg{false code}
\cs{IntIfEvenTF} \Arg{integer expression} \Arg{true code} \Arg{false code}
\end{syntax}
This function first evaluates the \meta{integer expression}
@@ -3163,9 +3336,11 @@
It then evaluates if this is even or odd, as appropriate.
\end{function}
-\begin{function}{\IntCompare,\IntCompareTF}
+\begin{function}{\IntCompare,\IntCompareT,\IntCompareF,\IntCompareTF}
\begin{syntax}
\cs{IntCompare} \Arg{intexpr_1} \meta{relation} \Arg{intexpr_2}
+\cs{IntCompareT} \Arg{intexpr_1} \meta{relation} \Arg{intexpr_2} \Arg{true code}
+\cs{IntCompareF} \Arg{intexpr_1} \meta{relation} \Arg{intexpr_2} \Arg{false code}
\cs{IntCompareTF} \Arg{intexpr_1} \meta{relation} \Arg{intexpr_2} \Arg{true code} \Arg{false code}
\end{syntax}
This function first evaluates each of the \meta{integer expressions}
@@ -3178,8 +3353,8 @@
\end{tabular}\par}
For example
\begin{demohigh}
-\IntCompareTF {2} > {1} {\Result{Greater}} {\Result{Less}}
-\IntCompareTF {2} > {3} {\Result{Greater}} {\Result{Less}}
+\IntCompareTF {2} > {1} {\Return{Greater}} {\Return{Less}}
+\IntCompareTF {2} > {3} {\Return{Greater}} {\Return{Less}}
\end{demohigh}
\end{function}
@@ -3637,7 +3812,7 @@
\FpStepInline {1} {0.1} {1.5} {
\TlPutRight \lTmpaTl {[#1]}
}
-\Result {\Value\lTmpaTl}
+\Return {\Value\lTmpaTl}
\IgnoreSpacesOff
\end{codehigh}
produces [1][1.1][1.2][1.3][1.4][1.5].
@@ -3663,7 +3838,7 @@
% \TlPutRight\lTmpaTl{\Value\lTmpiTl}
% \TlPutRight\lTmpaTl{~}
%}
-%\Result{\Value\lTmpaTl}
+%\Return{\Value\lTmpaTl}
%\IgnoreSpacesOff
%\end{demohigh}
\end{function}
@@ -3670,9 +3845,11 @@
\section{Float Point Conditionals}
-\begin{function}{\FpIfExist,\FpIfExistTF}
+\begin{function}{\FpIfExist,\FpIfExistT,\FpIfExistF,\FpIfExistTF}
\begin{syntax}
\cs{FpIfExist} \meta{fp var}
+\cs{FpIfExistT} \meta{fp var} \Arg{true code}
+\cs{FpIfExistF} \meta{fp var} \Arg{false code}
\cs{FpIfExistTF} \meta{fp var} \Arg{true code} \Arg{false code}
\end{syntax}
Tests whether the \meta{fp var} is currently defined. This does not
@@ -3679,21 +3856,23 @@
check that the \meta{fp var} really is a floating point variable.
For example
\begin{demohigh}
-\FpIfExistTF \lTmpaFp {\Result{Yes}} {\Result{No}}
-\FpIfExistTF \lMyUndefinedFp {\Result{Yes}} {\Result{No}}
+\FpIfExistTF \lTmpaFp {\Return{Yes}} {\Return{No}}
+\FpIfExistTF \lMyUndefinedFp {\Return{Yes}} {\Return{No}}
\end{demohigh}
\end{function}
-\begin{function}{\FpCompare,\FpCompareTF}
+\begin{function}{\FpCompare,\FpCompareT,\FpCompareF,\FpCompareTF}
\begin{syntax}
\cs{FpCompare} \Arg{fpexpr_1} \meta{relation} \Arg{fpexpr_2}
+\cs{FpCompareT} \Arg{fpexpr_1} \meta{relation} \Arg{fpexpr_2} \Arg{true code}
+\cs{FpCompareF} \Arg{fpexpr_1} \meta{relation} \Arg{fpexpr_2} \Arg{false code}
\cs{FpCompareTF} \Arg{fpexpr_1} \meta{relation} \Arg{fpexpr_2} \Arg{true code} \Arg{false code}
\end{syntax}
Compares the \meta{fpexpr_1} and the \meta{fpexpr_2}, and returns
\texttt{true} if the \meta{relation} is obeyed. For example
\begin{demohigh}
-\FpCompareTF {1} > {0.9999} {\Result{Greater}} {\Result{Less}}
-\FpCompareTF {1} > {1.0001} {\Result{Greater}} {\Result{Less}}
+\FpCompareTF {1} > {0.9999} {\Return{Greater}} {\Return{Less}}
+\FpCompareTF {1} > {1.0001} {\Return{Greater}} {\Return{Less}}
\end{demohigh}
Two floating points
$x$ and $y$ may obey four mutually exclusive relations:
@@ -3704,7 +3883,7 @@
a \nan{}. To test if a value is \nan{}, compare it to an arbitrary
number with the \enquote{not ordered} relation.\par
%\begin{demohigh}
-%\FpCompareTF{0/0}?{0}{\Result{Is~a~Nan}}{\Result{Isn't~a~NaN}}
+%\FpCompareTF{0/0}?{0}{\Return{Is~a~Nan}}{\Return{Isn't~a~NaN}}
%\end{demohigh}
Tuples are equal if they have the same number of items and items
compare equal (in particular there must be no \nan{}).
@@ -4029,7 +4208,7 @@
\DimStepInline {1pt} {0.1pt} {1.5pt} {
\TlPutRight \lTmpaTl {[#1]}
}
-\Result {\Value\lTmpaTl}
+\Return {\Value\lTmpaTl}
\IgnoreSpacesOff
\end{codehigh}
produces [1.0pt][1.1pt][1.20001pt][1.30002pt][1.40002pt].
@@ -4054,7 +4233,7 @@
% \TlPutRight\lTmpaTl{\Value\lTmpiTl}
% \TlPutRight\lTmpaTl{~}
%}
-%\Result{\Value\lTmpaTl}
+%\Return{\Value\lTmpaTl}
%\IgnoreSpacesOff
%\end{demohigh}
\end{function}
@@ -4061,9 +4240,11 @@
\section{Dimension Conditionals}
-\begin{function}{\DimIfExist,\DimIfExistTF}
+\begin{function}{\DimIfExist,\DimIfExistT,\DimIfExistF,\DimIfExistTF}
\begin{syntax}
\cs{DimIfExist} \meta{dimension}
+\cs{DimIfExistT} \meta{dimension} \Arg{true code}
+\cs{DimIfExistF} \meta{dimension} \Arg{false code}
\cs{DimIfExistTF} \meta{dimension} \Arg{true code} \Arg{false code}
\end{syntax}
Tests whether the \meta{dimension} is currently defined. This does
@@ -4070,14 +4251,16 @@
not check that the \meta{dimension} really is a dimension variable.
For example
\begin{demohigh}
-\DimIfExistTF \lTmpaDim {\Result{Yes}} {\Result{No}}
-\DimIfExistTF \lFooUndefinedDim {\Result{Yes}} {\Result{No}}
+\DimIfExistTF \lTmpaDim {\Return{Yes}} {\Return{No}}
+\DimIfExistTF \lFooUndefinedDim {\Return{Yes}} {\Return{No}}
\end{demohigh}
\end{function}
-\begin{function}{\DimCompare,\DimCompareTF}
+\begin{function}{\DimCompare,\DimCompareT,\DimCompareF,\DimCompareTF}
\begin{syntax}
\cs{DimCompare} \Arg{dimexpr_1} \meta{relation} \Arg{dimexpr_2}
+\cs{DimCompareT} \Arg{dimexpr_1} \meta{relation} \Arg{dimexpr_2} \Arg{true code}
+\cs{DimCompareF} \Arg{dimexpr_1} \meta{relation} \Arg{dimexpr_2} \Arg{false code}
\cs{DimCompareTF} \Arg{dimexpr_1} \meta{relation} \Arg{dimexpr_2} \Arg{true code} \Arg{false code}
\end{syntax}
This function first evaluates each of the \meta{dimension expressions}
@@ -4091,8 +4274,8 @@
\end{tabular}\par}
For example
\begin{demohigh}
-\DimCompareTF {1pt} > {0.9999pt} {\Result{Greater}} {\Result{Less}}
-\DimCompareTF {1pt} > {1.0001pt} {\Result{Greater}} {\Result{Less}}
+\DimCompareTF {1pt} > {0.9999pt} {\Return{Greater}} {\Return{Less}}
+\DimCompareTF {1pt} > {1.0001pt} {\Return{Greater}} {\Return{Less}}
\end{demohigh}
\end{function}
@@ -4157,11 +4340,11 @@
\IgnoreSpacesOn
\DimSet \lTmpaDim {5pt}
\DimCaseF {2\lTmpaDim} {
- {5pt} {\Result{Small}}
- {4pt+6pt} {\Result{Medium}}
- {-10pt} {\Result{Negative}}
+ {5pt} {\Return{Small}}
+ {4pt+6pt} {\Return{Medium}}
+ {-10pt} {\Return{Negative}}
}{
- \Result {No Match}
+ \Return {No Match}
}
\IgnoreSpacesOff
\end{demohigh}
@@ -4192,13 +4375,13 @@
%\IgnoreSpacesOn
%\DimSet\lTmpaDim{5pt}
%\DimCaseTF{2\lTmpaDim}{
-% {5pt} {\Result{Small}}
-% {4pt+6pt} {\Result{Medium}}
-% {-10pt} {\Result{Negative}}
+% {5pt} {\Return{Small}}
+% {4pt+6pt} {\Return{Medium}}
+% {-10pt} {\Return{Negative}}
%}{
-% \Result{[Some Match]}
+% \Return{[Some Match]}
%}{
-% \Result{[No Match]}
+% \Return{[No Match]}
%}
%\IgnoreSpacesOff
%\end{demohigh}
@@ -4697,7 +4880,7 @@
The \meta{token list variable} is assigned locally.
\begin{demohigh}
\ClistSet \lTmpaClist {two,three,four}
-\ClistGetTF \lTmpaClist \lTmpaTl {\Result{Yes}} {\Result{No}}
+\ClistGetTF \lTmpaClist \lTmpaTl {\Return{Yes}} {\Return{No}}
\end{demohigh}
\end{function}
@@ -4733,7 +4916,7 @@
The \meta{token list variable} is assigned locally.
\begin{demohigh}
\ClistSet \lTmpaClist {two,three,four}
-\ClistPopTF \lTmpaClist \lTmpaTl {\Result{Yes}} {\Result{No}}
+\ClistPopTF \lTmpaClist \lTmpaTl {\Return{Yes}} {\Return{No}}
\end{demohigh}
\end{function}
@@ -4801,7 +4984,7 @@
\ClistMapInline {one,two,three} {
\TlPutRight \lTmpaTl {(#1)}
}
-\Result {\TlUse\lTmpaTl}
+\Return {\TlUse\lTmpaTl}
\IgnoreSpacesOff
\end{codehigh}
produces (one)(two)(three).
@@ -4897,22 +5080,26 @@
\section{Comma List Conditionals}
-\begin{function}{\ClistIfExist,\ClistIfExistTF}
+\begin{function}{\ClistIfExist,\ClistIfExistT,\ClistIfExistF,\ClistIfExistTF}
\begin{syntax}
\cs{ClistIfExist} \meta{comma list}
+\cs{ClistIfExistT} \meta{comma list} \Arg{true code}
+\cs{ClistIfExistF} \meta{comma list} \Arg{false code}
\cs{ClistIfExistTF} \meta{comma list} \Arg{true code} \Arg{false code}
\end{syntax}
Tests whether the \meta{comma list} is currently defined. This does
not check that the \meta{comma list} really is a comma list.
\begin{demohigh}
-\ClistIfExistTF \lTmpaClist {\Result{Yes}} {\Result{No}}
-\ClistIfExistTF \lFooUndefinedClist {\Result{Yes}} {\Result{No}}
+\ClistIfExistTF \lTmpaClist {\Return{Yes}} {\Return{No}}
+\ClistIfExistTF \lFooUndefinedClist {\Return{Yes}} {\Return{No}}
\end{demohigh}
\end{function}
-\begin{function}{\ClistIfEmpty,\ClistIfEmptyTF}
+\begin{function}{\ClistIfEmpty,\ClistIfEmptyT,\ClistIfEmptyF,\ClistIfEmptyTF}
\begin{syntax}
\cs{ClistIfEmpty} \Arg{comma list}
+\cs{ClistIfEmptyT} \Arg{comma list} \Arg{true code}
+\cs{ClistIfEmptyF} \Arg{comma list} \Arg{false code}
\cs{ClistIfEmptyTF} \Arg{comma list} \Arg{true code} \Arg{false code}
\end{syntax}
Tests if the \meta{comma list} is empty (containing no items).
@@ -4922,28 +5109,32 @@
contains one element, which happens to be empty: the comma-list
is not empty.
\begin{demohigh}
-\ClistIfEmptyTF {one,two} {\Result{Empty}} {\Result{NonEmpty}}
-\ClistIfEmptyTF { , } {\Result{Empty}} {\Result{NonEmpty}}
+\ClistIfEmptyTF {one,two} {\Return{Empty}} {\Return{NonEmpty}}
+\ClistIfEmptyTF { , } {\Return{Empty}} {\Return{NonEmpty}}
\end{demohigh}
\end{function}
-\begin{function}{\ClistVarIfEmpty,\ClistVarIfEmptyTF}
+\begin{function}{\ClistVarIfEmpty,\ClistVarIfEmptyT,\ClistVarIfEmptyF,\ClistVarIfEmptyTF}
\begin{syntax}
\cs{ClistVarIfEmpty} \meta{comma list}
+\cs{ClistVarIfEmptyT} \meta{comma list} \Arg{true code}
+\cs{ClistVarIfEmptyF} \meta{comma list} \Arg{false code}
\cs{ClistVarIfEmptyTF} \meta{comma list} \Arg{true code} \Arg{false code}
\end{syntax}
Tests if the \meta{comma list} is empty (containing no items).
\begin{demohigh}
\ClistSet \lTmpaClist {one,two}
-\ClistVarIfEmptyTF \lTmpaClist {\Result{Empty}} {\Result{NonEmpty}}
+\ClistVarIfEmptyTF \lTmpaClist {\Return{Empty}} {\Return{NonEmpty}}
\ClistClear \lTmpaClist
-\ClistVarIfEmptyTF \lTmpaClist {\Result{Empty}} {\Result{NonEmpty}}
+\ClistVarIfEmptyTF \lTmpaClist {\Return{Empty}} {\Return{NonEmpty}}
\end{demohigh}
\end{function}
-\begin{function}{\ClistIfIn,\ClistIfInTF}
+\begin{function}{\ClistIfIn,\ClistIfInT,\ClistIfInF,\ClistIfInTF}
\begin{syntax}
\cs{ClistIfIn} \Arg{comma list} \Arg{item}
+\cs{ClistIfInT} \Arg{comma list} \Arg{item} \Arg{true code}
+\cs{ClistIfInF} \Arg{comma list} \Arg{item} \Arg{false code}
\cs{ClistIfInTF} \Arg{comma list} \Arg{item} \Arg{true code} \Arg{false code}
\end{syntax}
Tests if the \meta{item} is present in the \meta{comma list}.
@@ -4950,8 +5141,8 @@
In the case of an \texttt{n}-type \meta{comma list}, the usual rules
of space trimming and brace stripping apply. For example
\begin{demohigh}
-\ClistIfInTF { a , {b} , {b} , c } {b} {\Result{Yes}} {\Result{No}}
-\ClistIfInTF { a , {b} , {b} , c } {d} {\Result{Yes}} {\Result{No}}
+\ClistIfInTF { a , {b} , {b} , c } {b} {\Return{Yes}} {\Return{No}}
+\ClistIfInTF { a , {b} , {b} , c } {d} {\Return{Yes}} {\Return{No}}
\end{demohigh}
%\begin{texnote}
%The function may fail if the \meta{item} contains \verb|{|, \verb|}|, or \verb|#|
@@ -4959,9 +5150,11 @@
%\end{texnote}
\end{function}
-\begin{function}{\ClistVarIfIn,\ClistVarIfInTF}
+\begin{function}{\ClistVarIfIn,\ClistVarIfInT,\ClistVarIfInF,\ClistVarIfInTF}
\begin{syntax}
\cs{ClistVarIfIn} \meta{comma list} \Arg{item}
+\cs{ClistVarIfInT} \meta{comma list} \Arg{item} \Arg{true code}
+\cs{ClistVarIfInF} \meta{comma list} \Arg{item} \Arg{false code}
\cs{ClistVarIfInTF} \meta{comma list} \Arg{item} \Arg{true code} \Arg{false code}
\end{syntax}
Tests if the \meta{item} is present in the \meta{comma list}.
@@ -4969,8 +5162,8 @@
of space trimming and brace stripping apply.
\begin{demohigh}
\ClistSet \lTmpaClist {one,two}
-\ClistVarIfInTF \lTmpaClist {one} {\Result{Yes}} {\Result{No}}
-\ClistVarIfInTF \lTmpaClist {three} {\Result{Yes}} {\Result{No}}
+\ClistVarIfInTF \lTmpaClist {one} {\Return{Yes}} {\Return{No}}
+\ClistVarIfInTF \lTmpaClist {three} {\Return{Yes}} {\Return{No}}
\end{demohigh}
%\begin{texnote}
%The function may fail if the \meta{item} contains \verb|{|, \verb|}|, or \verb|#|
@@ -5407,7 +5600,7 @@
the \meta{sequence}. The \meta{token list variable} is assigned locally.
\begin{demohigh}
\SeqSetFromClist \lTmpaSeq {two,three,four}
-\SeqGetTF \lTmpaSeq \lTmpaTl {\Result{Yes}} {\Result{No}}
+\SeqGetTF \lTmpaSeq \lTmpaTl {\Return{Yes}} {\Return{No}}
\end{demohigh}
\end{function}
@@ -5439,7 +5632,7 @@
in the \meta{token list variable}, \emph{i.e.} removes the item from the
\meta{sequence}. The \meta{token list variable} is assigned locally.
\begin{demohigh}
-\SeqPopTF \cEmptySeq \lTmpaTl {\Result{Yes}} {\Result{No}}
+\SeqPopTF \cEmptySeq \lTmpaTl {\Return{Yes}} {\Return{No}}
\end{demohigh}
\end{function}
@@ -5496,7 +5689,7 @@
The \meta{token list variable} is assigned locally.
\begin{demohigh}
\SeqSetFromClist \lTmpaSeq {two,three,four}
-\SeqGetLeftTF \lTmpaSeq \lTmpaTl {\Result{Yes}} {\Result{No}}
+\SeqGetLeftTF \lTmpaSeq \lTmpaTl {\Return{Yes}} {\Return{No}}
\end{demohigh}
\end{function}
@@ -5532,7 +5725,7 @@
The \meta{token list variable} is assigned locally.
\begin{demohigh}
\SeqSetFromClist \lTmpaSeq {two,three,four}
-\SeqGetRightTF \lTmpaSeq \lTmpaTl {\Result{Yes}} {\Result{No}}
+\SeqGetRightTF \lTmpaSeq \lTmpaTl {\Return{Yes}} {\Return{No}}
\end{demohigh}
\end{function}
@@ -5567,7 +5760,7 @@
\meta{sequence}, then leaves the \meta{true code} in the input stream.
The \meta{token list variable} is assigned locally.
\begin{demohigh}
-\SeqPopLeftTF \cEmptySeq \lTmpaTl {\Result{Yes}} {\Result{No}}
+\SeqPopLeftTF \cEmptySeq \lTmpaTl {\Return{Yes}} {\Return{No}}
\end{demohigh}
\end{function}
@@ -5602,7 +5795,7 @@
\meta{sequence}, then leaves the \meta{true code} in the input stream.
The \meta{token list variable} is assigned locally.
\begin{demohigh}
-\SeqPopRightTF \cEmptySeq \lTmpaTl {\Result{Yes}} {\Result{No}}
+\SeqPopRightTF \cEmptySeq \lTmpaTl {\Return{Yes}} {\Return{No}}
\end{demohigh}
\end{function}
@@ -5639,7 +5832,7 @@
\SeqVarMapInline \lTmpkSeq {
\TlPutRight \lTmpaTl {(#1)}
}
-\Result {\TlUse\lTmpaTl}
+\Return {\TlUse\lTmpaTl}
\IgnoreSpacesOff
\end{codehigh}
produces (one)(two)(three).
@@ -5679,7 +5872,7 @@
\SeqVarMapVariable \lTmpaSeq \lTmpiTl {
\IntAdd \lTmpaInt {\lTmpiTl*\lTmpiTl}
}
-\Result {\IntUse\lTmpaInt}
+\Return {\IntUse\lTmpaInt}
\IgnoreSpacesOff
\end{demohigh}
\end{function}
@@ -5795,43 +5988,49 @@
\section{Sequence Conditionals}
-\begin{function}{\SeqIfExist,\SeqIfExistTF}
+\begin{function}{\SeqIfExist,\SeqIfExistT,\SeqIfExistF,\SeqIfExistTF}
\begin{syntax}
\cs{SeqIfExist} \meta{sequence}
+\cs{SeqIfExistT} \meta{sequence} \Arg{true code}
+\cs{SeqIfExistF} \meta{sequence} \Arg{false code}
\cs{SeqIfExistTF} \meta{sequence} \Arg{true code} \Arg{false code}
\end{syntax}
Tests whether the \meta{sequence} is currently defined. This does not
check that the \meta{sequence} really is a sequence variable.
\begin{demohigh}
-\SeqIfExistTF \lTmpaSeq {\Result{Yes}} {\Result{No}}
-\SeqIfExistTF \lFooUndefinedSeq {\Result{Yes}} {\Result{No}}
+\SeqIfExistTF \lTmpaSeq {\Return{Yes}} {\Return{No}}
+\SeqIfExistTF \lFooUndefinedSeq {\Return{Yes}} {\Return{No}}
\end{demohigh}
\end{function}
-\begin{function}{\SeqVarIfEmpty,\SeqVarIfEmptyTF}
+\begin{function}{\SeqVarIfEmpty,\SeqVarIfEmptyT,\SeqVarIfEmptyF,\SeqVarIfEmptyTF}
\begin{syntax}
\cs{SeqVarIfEmpty} \meta{sequence}
+\cs{SeqVarIfEmptyT} \meta{sequence} \Arg{true code}
+\cs{SeqVarIfEmptyF} \meta{sequence} \Arg{false code}
\cs{SeqVarIfEmptyTF} \meta{sequence} \Arg{true code} \Arg{false code}
\end{syntax}
Tests if the \meta{sequence} is empty (containing no items).
\begin{demohigh}
\SeqSetFromClist \lTmpaSeq {one,two}
-\SeqVarIfEmptyTF \lTmpaSeq {\Result{Empty}} {\Result{NonEmpty}}
+\SeqVarIfEmptyTF \lTmpaSeq {\Return{Empty}} {\Return{NonEmpty}}
\SeqClear \lTmpaSeq
-\SeqVarIfEmptyTF \lTmpaSeq {\Result{Empty}} {\Result{NonEmpty}}
+\SeqVarIfEmptyTF \lTmpaSeq {\Return{Empty}} {\Return{NonEmpty}}
\end{demohigh}
\end{function}
-\begin{function}{\SeqVarIfIn,\SeqVarIfInTF}
+\begin{function}{\SeqVarIfIn,\SeqVarIfInT,\SeqVarIfInF,\SeqVarIfInTF}
\begin{syntax}
\cs{SeqVarIfIn} \meta{sequence} \Arg{item}
+\cs{SeqVarIfInT} \meta{sequence} \Arg{item} \Arg{true code}
+\cs{SeqVarIfInF} \meta{sequence} \Arg{item} \Arg{false code}
\cs{SeqVarIfInTF} \meta{sequence} \Arg{item} \Arg{true code} \Arg{false code}
\end{syntax}
Tests if the \meta{item} is present in the \meta{sequence}.
\begin{demohigh}
\SeqSetFromClist \lTmpaSeq {one,two}
-\SeqVarIfInTF \lTmpaSeq {one} {\Result{Yes}} {\Result{Not}}
-\SeqVarIfInTF \lTmpaSeq {three} {\Result{Yes}} {\Result{Not}}
+\SeqVarIfInTF \lTmpaSeq {one} {\Return{Yes}} {\Return{Not}}
+\SeqVarIfInTF \lTmpaSeq {three} {\Return{Yes}} {\Return{Not}}
\end{demohigh}
\end{function}
@@ -6173,7 +6372,7 @@
stream. The \meta{token list variable} is assigned locally.
\begin{demohigh}
\PropSetFromKeyval \lTmpaProp {key1=one,key2=two,key3=three}
-\PropGetTF \lTmpaProp {key2} \lTmpaTl {\Result{Yes}} {\Result{No}}
+\PropGetTF \lTmpaProp {key2} \lTmpaTl {\Return{Yes}} {\Return{No}}
\end{demohigh}
\end{function}
@@ -6211,7 +6410,7 @@
The \meta{token list variable} is assigned locally.
\begin{demohigh}
\PropSetFromKeyval \lTmpaProp {key1=one,key2=two,key3=three}
-\PropPopTF \lTmpaProp {key2} \lTmpaTl {\Result{Yes}} {\Result{No}}
+\PropPopTF \lTmpaProp {key2} \lTmpaTl {\Return{Yes}} {\Return{No}}
\end{demohigh}
\end{function}
@@ -6252,7 +6451,7 @@
\PropVarMapInline \lTmpkProp {
\TlPutRight \lTmpaTl {(#1=#2)}
}
-\Result {\TlUse\lTmpaTl}
+\Return {\TlUse\lTmpaTl}
\IgnoreSpacesOff
\end{codehigh}
produces (key1=one)(key2=two)(key3=three).
@@ -6332,43 +6531,50 @@
\section{Property List Conditionals}
-\begin{function}{\PropIfExist}
+\begin{function}{\PropIfExist,\PropIfExistT,\PropIfExistF,\PropIfExistTF}
\begin{syntax}
\cs{PropIfExist} \meta{property list}
+\cs{PropIfExistT} \meta{property list} \Arg{true code}
+\cs{PropIfExistF} \meta{property list} \Arg{false code}
\cs{PropIfExistTF} \meta{property list} \Arg{true code} \Arg{false code}
\end{syntax}
Tests whether the \meta{property list} is currently defined. This does not
check that the \meta{property list} really is a property list variable.
\begin{demohigh}
-\PropIfExistTF \lTmpaProp {\Result{Yes}} {\Result{No}}
-\PropIfExistTF \lFooUndefinedProp {\Result{Yes}} {\Result{No}}
+\PropIfExistTF \lTmpaProp {\Return{Yes}} {\Return{No}}
+\PropIfExistTF \lFooUndefinedProp {\Return{Yes}} {\Return{No}}
\end{demohigh}
\end{function}
-\begin{function}{\PropVarIfEmpty}
+\begin{function}{\PropVarIfEmpty,\PropVarIfEmptyT,\PropVarIfEmptyF,\PropVarIfEmptyTF}
\begin{syntax}
\cs{PropVarIfEmpty} \meta{property list}
+\cs{PropVarIfEmptyT} \meta{property list} \Arg{true code}
+\cs{PropVarIfEmptyF} \meta{property list} \Arg{false code}
\cs{PropVarIfEmptyTF} \meta{property list} \Arg{true code} \Arg{false code}
\end{syntax}
Tests if the \meta{property list} is empty (containing no entries).
\begin{demohigh}
\PropSetFromKeyval \lTmpaProp {key1=one,key2=two}
-\PropVarIfEmptyTF \lTmpaProp {\Result{Empty}} {\Result{NonEmpty}}
+\PropVarIfEmptyTF \lTmpaProp {\Return{Empty}} {\Return{NonEmpty}}
\PropClear \lTmpaProp
-\PropVarIfEmptyTF \lTmpaProp {\Result{Empty}} {\Result{NonEmpty}}
+\PropVarIfEmptyTF \lTmpaProp {\Return{Empty}} {\Return{NonEmpty}}
\end{demohigh}
\end{function}
-\begin{function}{\PropVarIfIn}
+\begin{function}{\PropVarIfIn,\PropVarIfInT,\PropVarIfInF,\PropVarIfInTF}
\begin{syntax}
-\cs{PropVarIfIn} \meta{property list} \Arg{key} \Arg{true code} \Arg{false code}
+\cs{PropVarIfIn} \meta{property list} \Arg{key}
+\cs{PropVarIfInT} \meta{property list} \Arg{key} \Arg{true code}
+\cs{PropVarIfInF} \meta{property list} \Arg{key} \Arg{false code}
+\cs{PropVarIfInTF} \meta{property list} \Arg{key} \Arg{true code} \Arg{false code}
\end{syntax}
Tests if the \meta{key} is present in the \meta{property list},
making the comparison using the method described by \cs{StrIfEqTF}.
\begin{demohigh}
\PropSetFromKeyval \lTmpaProp {key1=one,key2=two}
-\PropVarIfInTF \lTmpaProp {key1} {\Result{Yes}} {\Result{Not}}
-\PropVarIfInTF \lTmpaProp {key3} {\Result{Yes}} {\Result{Not}}
+\PropVarIfInTF \lTmpaProp {key1} {\Return{Yes}} {\Return{Not}}
+\PropVarIfInTF \lTmpaProp {key3} {\Return{Yes}} {\Return{Not}}
\end{demohigh}
%\begin{texnote}
%This function iterates through every key--value pair in the
@@ -6404,24 +6610,26 @@
\section{Quark Conditionals}
-\begin{function}{\QuarkVarIfNoValue,\QuarkVarIfNoValueTF}
+\begin{function}{\QuarkVarIfNoValue,\QuarkVarIfNoValueT,\QuarkVarIfNoValueF,\QuarkVarIfNoValueTF}
\begin{syntax}
\cs{QuarkVarIfNoValue} \meta{token}
+\cs{QuarkVarIfNoValueT} \meta{token} \Arg{true code}
+\cs{QuarkVarIfNoValueF} \meta{token} \Arg{false code}
\cs{QuarkVarIfNoValueTF} \meta{token} \Arg{true code} \Arg{false code}
\end{syntax}
Tests if the \meta{token} is equal to \cs{qNoValue}.
\begin{demohigh}
\ClistGet \cEmptyClist \lTmpaTl
-\QuarkVarIfNoValueTF \lTmpaTl {\Result{NoValue}} {\Result{SomeValue}}
+\QuarkVarIfNoValueTF \lTmpaTl {\Return{NoValue}} {\Return{SomeValue}}
\end{demohigh}
\begin{demohigh}
\SeqPop \cEmptySeq \lTmpaTl
-\QuarkVarIfNoValueTF \lTmpaTl {\Result{NoValue}} {\Result{SomeValue}}
+\QuarkVarIfNoValueTF \lTmpaTl {\Return{NoValue}} {\Return{SomeValue}}
\end{demohigh}
\begin{demohigh}
\PropSetFromKeyval \lTmpaProp {key1=one,key2=two}
\PropGet \lTmpaProp {key3} \lTmpaTl
-\QuarkVarIfNoValueTF \lTmpaTl {\Result{NoValue}} {\Result{SomeValue}}
+\QuarkVarIfNoValueTF \lTmpaTl {\Return{NoValue}} {\Return{SomeValue}}
\end{demohigh}
\end{function}
@@ -6435,6 +6643,57 @@
%\cs{qNoValue} plus one or more other tokens).
%\end{function}
+\chapter{Legacy Concepts (\texttt{Legacy})}
+
+There are a small number of \TeX{} or \LaTeXe{} concepts which are not used
+in \pkg{functional} code but which need to be manipulated when working as a \LaTeXe{}
+package. To allow these to be integrated cleanly into \pkg{functional} code, a set
+of legacy interfaces are provided here.
+
+\begin{function}{\LegacyIf,\LegacyIfT,\LegacyIfF,\LegacyIfTF}
+\begin{syntax}
+\cs{LegacyIf} \Arg{name}
+\cs{LegacyIfT} \Arg{name} \Arg{true code}
+\cs{LegacyIfF} \Arg{name} \Arg{false code}
+\cs{LegacyIfTF} \Arg{name} \Arg{true code} \Arg{false code}
+\end{syntax}
+Tests if the \LaTeXe{}/plain \TeX{} conditional (generated by \tn{newif})
+if \texttt{true} or \texttt{false} and branches \hbox{accordingly}. The
+\meta{name} of the conditional should \emph{omit} the leading \texttt{if}.
+\begin{demohigh}
+\newif \ifFooBar
+\LegacyIfTF {FooBar} {\Return{True!}} {\Return{False!}}
+\end{demohigh}
+\end{function}
+
+\begin{function}{\LegacyIfSetTrue,\LegacyIfSetFalse}
+\begin{syntax}
+\cs{LegacyIfSetTrue} \Arg{name}
+\cs{LegacyIfSetFalse} \Arg{name}
+\end{syntax}
+Sets the \LaTeXe{}/plain \TeX{} conditional \verb|\if|\meta{name}
+(generated by \tn{newif}) to be \texttt{true} or \texttt{false}.
+\begin{demohigh}
+\newif \ifFooBar
+\LegacyIfSetTrue {FooBar}
+\LegacyIfTF {FooBar} {\Return{True!}} {\Return{False!}}
+\end{demohigh}
+\end{function}
+
+\begin{function}{\LegacyIfSet}
+\begin{syntax}
+\cs{LegacyIfSet} \Arg{name} \Arg{boolexpr}
+\end{syntax}
+Sets the \LaTeXe{}/plain \TeX{} conditional \verb|\if|\meta{name}
+(generated by \tn{newif}) to the result of evaluating the
+\meta{boolean expression}.
+\begin{demohigh}
+\newif \ifFooBar
+\LegacyIfSet {FooBar} {\cFalseBool}
+\LegacyIfTF {FooBar} {\Return{True!}} {\Return{False!}}
+\end{demohigh}
+\end{function}
+
\chapter{The Source Code}
%\CodeHigh{lite}
Modified: trunk/Master/texmf-dist/tex/latex/functional/functional.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/functional/functional.sty 2022-04-15 05:19:42 UTC (rev 63033)
+++ trunk/Master/texmf-dist/tex/latex/functional/functional.sty 2022-04-15 21:13:40 UTC (rev 63034)
@@ -14,7 +14,7 @@
\NeedsTeXFormat{LaTeX2e}[2018-04-01]
\RequirePackage{expl3}
-\ProvidesExplPackage{functional}{2022-04-01}{2022C}
+\ProvidesExplPackage{functional}{2022-04-15}{2022D}
{^^JLaTeX2 functional interfaces for LaTeX3 programming layer}
\cs_generate_variant:Nn \iow_log:n { V }
@@ -81,17 +81,63 @@
\cs_set_eq:NN \PrgNewFunction \__fun_new_function:Nnn
\tl_new:N \g__fun_last_result_tl
+\int_new:N \l__fun_cond_arg_count_int
%% #1: function name; #2: argument specification; #3 function body
\cs_new_protected:Npn \__fun_new_conditional:Nnn #1 #2 #3
{
\__fun_new_function:Nnn #1 { #2 } { #3 }
+ \int_set:Nn \l__fun_cond_arg_count_int { \tl_count:n {#2} }
\tl_set_eq:Nc \l__fun_parameters_called_tl
- { c__fun_parameter_called_i_ \int_to_roman:n { \l__fun_arg_count_int } _tl }
+ {
+ c__fun_parameter_called_i_
+ \int_to_roman:n { \l__fun_cond_arg_count_int } _tl
+ }
+ %% define function \FooIfBarT for #1=\FooIfBar
\tl_set_eq:Nc \l__fun_parameters_true_tl
- { c__fun_parameter_called_ \int_to_roman:n { \l__fun_arg_count_int + 1 } _tl }
+ {
+ c__fun_parameter_called_
+ \int_to_roman:n { \l__fun_cond_arg_count_int + 1 } _tl
+ }
+ \__fun_new_function:cne { \cs_to_str:N #1 T } { #2 n }
+ {
+ #1 \exp_not:V \l__fun_parameters_called_tl
+ \exp_not:n
+ {
+ \tl_set_eq:NN \g__fun_last_result_tl \gResultTl
+ \tl_gclear:N \gResultTl
+ \exp_last_unbraced:NV \bool_if:NT \g__fun_last_result_tl
+ }
+ \exp_not:V \l__fun_parameters_true_tl
+ }
+ %% define function \FooIfBarF for #1=\FooIfBar
\tl_set_eq:Nc \l__fun_parameters_false_tl
- { c__fun_parameter_called_ \int_to_roman:n { \l__fun_arg_count_int + 2 } _tl }
+ {
+ c__fun_parameter_called_
+ \int_to_roman:n { \l__fun_cond_arg_count_int + 1 } _tl
+ }
+ \__fun_new_function:cne { \cs_to_str:N #1 F } { #2 n }
+ {
+ #1 \exp_not:V \l__fun_parameters_called_tl
+ \exp_not:n
+ {
+ \tl_set_eq:NN \g__fun_last_result_tl \gResultTl
+ \tl_gclear:N \gResultTl
+ \exp_last_unbraced:NV \bool_if:NF \g__fun_last_result_tl
+ }
+ \exp_not:V \l__fun_parameters_false_tl
+ }
+ %% define function \FooIfBarTF for #1=\FooIfBar
+ \tl_set_eq:Nc \l__fun_parameters_true_tl
+ {
+ c__fun_parameter_called_
+ \int_to_roman:n { \l__fun_cond_arg_count_int + 1 } _tl
+ }
+ \tl_set_eq:Nc \l__fun_parameters_false_tl
+ {
+ c__fun_parameter_called_
+ \int_to_roman:n { \l__fun_cond_arg_count_int + 2 } _tl
+ }
\__fun_new_function:cne { \cs_to_str:N #1 TF } { #2 n n }
{
#1 \exp_not:V \l__fun_parameters_called_tl
@@ -432,6 +478,11 @@
}
\cs_generate_variant:Nn \__fun_put_result:n { e, V }
+\PrgNewFunction \Return { m }
+ {
+ \__fun_put_result:n { #1 }
+ }
+%% Obsolete function, will be removed in the future
\PrgNewFunction \Result { m }
{
\__fun_put_result:n { #1 }
@@ -599,9 +650,9 @@
\cs_set_eq:NN \OnlyExpandF \exp_not:f
\cs_set_eq:NN \OnlyExpandO \exp_not:o
-\PrgNewFunction \UseOne { n } { \Result { #1 } }
+\PrgNewFunction \UseOne { n } { \Return { #1 } }
-\PrgNewFunction \GobbleOne { n } { \Result { } }
+\PrgNewFunction \GobbleOne { n } { \Return { } }
\PrgNewFunction \UseGobble { n n } { \UseOne { #1 } }
@@ -657,35 +708,55 @@
\PrgNewConditional \BoolIfExist { M }
{
- \bool_if_exist:NTF #1 { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ \bool_if_exist:NTF #1 { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
-\PrgNewConditional \BoolVarIf { M } { \Result { #1 } }
+\PrgNewConditional \BoolVarIf { M } { \Return { #1 } }
\PrgNewConditional \BoolVarNot { M }
{
\bool_if:NTF #1
- { \Result { \cFalseBool } } { \Result { \cTrueBool } }
+ { \Return { \cFalseBool } } { \Return { \cTrueBool } }
}
\PrgNewConditional \BoolVarAnd { M M }
{
\bool_lazy_and:nnTF {#1} {#2}
- { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
\PrgNewConditional \BoolVarOr { M M }
{
\bool_lazy_or:nnTF {#1} {#2}
- { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
\PrgNewConditional \BoolVarXor { M M }
{
\bool_xor:nnTF {#1} {#2}
- { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
+\PrgNewFunction \BoolVarDoUntil { N n }
+ {
+ \bool_do_until:Nn #1 {#2}
+ }
+
+\PrgNewFunction \BoolVarDoWhile { N n }
+ {
+ \bool_do_while:Nn #1 {#2}
+ }
+
+\PrgNewFunction \BoolVarUntilDo { N n }
+ {
+ \bool_until_do:Nn #1 {#2}
+ }
+
+\PrgNewFunction \BoolVarWhileDo { N n }
+ {
+ \bool_while_do:Nn #1 {#2}
+ }
+
%%% --------------------------------------------------------
%%> \section{Interfaces for Token Lists (Tl)}
%%% --------------------------------------------------------
@@ -712,7 +783,7 @@
\PrgNewFunction \TlVarShow { M } { \tl_show:N #1 }
-\PrgNewFunction \TlUse { M } { \Result { \Value #1 } }
+\PrgNewFunction \TlUse { M } { \Return { \Value #1 } }
\PrgNewFunction \TlToStr { m } { \Expand { \tl_to_str:n { #1 } } }
@@ -836,52 +907,52 @@
\PrgNewConditional \TlIfExist { M }
{
- \tl_if_exist:NTF #1 { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ \tl_if_exist:NTF #1 { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
\PrgNewConditional \TlIfEmpty { m }
{
- \tl_if_empty:nTF {#1} { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ \tl_if_empty:nTF {#1} { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
\PrgNewConditional \TlVarIfEmpty { M }
{
- \tl_if_empty:NTF #1 { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ \tl_if_empty:NTF #1 { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
\PrgNewConditional \TlIfBlank { m }
{
- \tl_if_blank:nTF {#1} { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ \tl_if_blank:nTF {#1} { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
\PrgNewConditional \TlIfEq { m m }
{
- \tl_if_eq:nnTF {#1} {#2} { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ \tl_if_eq:nnTF {#1} {#2} { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
\PrgNewConditional \TlVarIfEq { M M }
{
- \tl_if_eq:NNTF #1 #2 { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ \tl_if_eq:NNTF #1 #2 { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
\PrgNewConditional \TlIfIn { m m }
{
- \tl_if_in:nnTF {#1} {#2} { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ \tl_if_in:nnTF {#1} {#2} { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
\PrgNewConditional \TlVarIfIn { M m }
{
- \tl_if_in:NnTF #1 {#2} { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ \tl_if_in:NnTF #1 {#2} { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
\PrgNewConditional \TlIfSingle { m }
{
- \tl_if_single:nTF {#1} { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ \tl_if_single:nTF {#1} { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
\PrgNewConditional \TlVarIfSingle { M }
{
- \tl_if_single:NTF #1 { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ \tl_if_single:NTF #1 { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
%%% --------------------------------------------------------
@@ -920,7 +991,7 @@
\PrgNewFunction \StrVarShow { M } { \str_show:N #1 }
-\PrgNewFunction \StrUse { M } { \Result { \Value #1 } }
+\PrgNewFunction \StrUse { M } { \Return { \Value #1 } }
\PrgNewFunction \StrConst { M m } { \str_const:Nn #1 {#2} }
@@ -1034,32 +1105,32 @@
\PrgNewConditional \StrIfExist { M }
{
- \str_if_exist:NTF #1 { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ \str_if_exist:NTF #1 { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
\PrgNewConditional \StrVarIfEmpty { M }
{
- \str_if_empty:NTF #1 { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ \str_if_empty:NTF #1 { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
\PrgNewConditional \StrIfEq { m m }
{
- \str_if_eq:nnTF {#1} {#2} { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ \str_if_eq:nnTF {#1} {#2} { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
\PrgNewConditional \StrVarIfEq { M M }
{
- \str_if_eq:NNTF #1 #2 { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ \str_if_eq:NNTF #1 #2 { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
\PrgNewConditional \StrIfIn { m m }
{
- \str_if_in:nnTF {#1} {#2} { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ \str_if_in:nnTF {#1} {#2} { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
\PrgNewConditional \StrVarIfIn { M m }
{
- \str_if_in:NnTF #1 {#2} { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ \str_if_in:NnTF #1 {#2} { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
%% Avoid naming confict with xstring package
@@ -1068,8 +1139,8 @@
\PrgNewConditional \StrCompare { m N m }
{
\str_compare:nNnTF {#1} #2 {#3}
- { \Result { \cTrueBool } }
- { \Result { \cFalseBool } }
+ { \Return { \cTrueBool } }
+ { \Return { \cFalseBool } }
}
}
@@ -1077,8 +1148,8 @@
\PrgNewConditional \StrIfCompare { m N m }
{
\str_compare:nNnTF {#1} #2 {#3}
- { \Result { \cTrueBool } }
- { \Result { \cFalseBool } }
+ { \Return { \cTrueBool } }
+ { \Return { \cFalseBool } }
}
%%% --------------------------------------------------------
@@ -1101,25 +1172,25 @@
\PrgNewFunction \IntEval { m }
{
- \Result { \Expand { \int_eval:n { #1 } } }
+ \Return { \Expand { \int_eval:n { #1 } } }
}
\PrgNewFunction \IntMathAdd { m m }
{
\int_set:Nn \l at Funx@Int { \int_eval:n { (#1) + (#2) } }
- \Result { \Value \l at Funx@Int }
+ \Return { \Value \l at Funx@Int }
}
\PrgNewFunction \IntMathSub { m m }
{
\int_set:Nn \l at Funx@Int { \int_eval:n { (#1) - (#2) } }
- \Result { \Value \l at Funx@Int }
+ \Return { \Value \l at Funx@Int }
}
\PrgNewFunction \IntMathMult { m m }
{
\int_set:Nn \l at Funx@Int { \int_eval:n { (#1) * (#2) } }
- \Result { \Value \l at Funx@Int }
+ \Return { \Value \l at Funx@Int }
}
\PrgNewFunction \IntMathDiv { m m }
@@ -1156,7 +1227,7 @@
\PrgNewFunction \IntVarShow { M } { \int_show:N #1 }
-\PrgNewFunction \IntUse { M } { \Result { \Value #1 } }
+\PrgNewFunction \IntUse { M } { \Return { \Value #1 } }
\PrgNewFunction \IntSet { M m }
{
@@ -1210,24 +1281,24 @@
\PrgNewConditional \IntIfExist { M }
{
- \int_if_exist:NTF #1 { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ \int_if_exist:NTF #1 { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
\PrgNewConditional \IntIfOdd { m }
{
- \int_if_odd:nTF { #1 } { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ \int_if_odd:nTF { #1 } { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
\PrgNewConditional \IntIfEven { m }
{
- \int_if_even:nTF { #1 } { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ \int_if_even:nTF { #1 } { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
\PrgNewConditional \IntCompare { m N m }
{
\int_compare:nNnTF {#1} #2 {#3}
- { \Result { \cTrueBool } }
- { \Result { \cFalseBool } }
+ { \Return { \cTrueBool } }
+ { \Return { \cFalseBool } }
}
\PrgNewFunction \IntCase { m m } { \int_case:nn {#1} {#2} }
@@ -1258,51 +1329,51 @@
\PrgNewFunction \FpEval { m }
{
- \Result { \Expand { \fp_eval:n { #1 } } }
+ \Return { \Expand { \fp_eval:n { #1 } } }
}
\PrgNewFunction \FpMathAdd { m m }
{
\fp_set:Nn \l at Funx@Fp { \fp_eval:n { (#1) + (#2) } }
- \Result { \FpUse \l at Funx@Fp }
+ \Return { \FpUse \l at Funx@Fp }
}
\PrgNewFunction \FpMathSub { m m }
{
\fp_set:Nn \l at Funx@Fp { \fp_eval:n { (#1) - (#2) } }
- \Result { \FpUse \l at Funx@Fp }
+ \Return { \FpUse \l at Funx@Fp }
}
\PrgNewFunction \FpMathMult { m m }
{
\fp_set:Nn \l at Funx@Fp { \fp_eval:n { (#1) * (#2) } }
- \Result { \FpUse \l at Funx@Fp }
+ \Return { \FpUse \l at Funx@Fp }
}
\PrgNewFunction \FpMathDiv { m m }
{
\fp_set:Nn \l at Funx@Fp { \fp_eval:n { (#1) / (#2) } }
- \Result { \FpUse \l at Funx@Fp }
+ \Return { \FpUse \l at Funx@Fp }
}
\PrgNewFunction \FpMathSign { m }
{
- \Result { \Expand { \fp_sign:n { #1 } } }
+ \Return { \Expand { \fp_sign:n { #1 } } }
}
\PrgNewFunction \FpMathAbs { m }
{
- \Result { \Expand { \fp_abs:n { #1 } } }
+ \Return { \Expand { \fp_abs:n { #1 } } }
}
\PrgNewFunction \FpMathMax { m m }
{
- \Result { \Expand { \fp_max:nn { #1 } { #2 } } }
+ \Return { \Expand { \fp_max:nn { #1 } { #2 } } }
}
\PrgNewFunction \FpMathMin { m m }
{
- \Result { \Expand { \fp_min:nn { #1 } { #2 } } }
+ \Return { \Expand { \fp_min:nn { #1 } { #2 } } }
}
\PrgNewFunction \FpNew { M } { \fp_new:N #1 }
@@ -1309,7 +1380,7 @@
\PrgNewFunction \FpConst { M m } { \fp_const:Nn #1 {#2} }
-\PrgNewFunction \FpUse { M } { \Result { \Expand { \fp_use:N #1 } } }
+\PrgNewFunction \FpUse { M } { \Return { \Expand { \fp_use:N #1 } } }
\PrgNewFunction \FpLog { m } { \fp_log:n { #1 } }
@@ -1361,14 +1432,14 @@
\PrgNewConditional \FpIfExist { M }
{
- \fp_if_exist:NTF #1 { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ \fp_if_exist:NTF #1 { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
\PrgNewConditional \FpCompare { m N m }
{
\fp_compare:nNnTF {#1} #2 {#3}
- { \Result { \cTrueBool } }
- { \Result { \cFalseBool } }
+ { \Return { \cTrueBool } }
+ { \Return { \cFalseBool } }
}
%%% --------------------------------------------------------
@@ -1388,44 +1459,44 @@
\PrgNewFunction \DimEval { m }
{
- \Result { \Expand { \dim_eval:n { #1 } } }
+ \Return { \Expand { \dim_eval:n { #1 } } }
}
\PrgNewFunction \DimMathAdd { m m }
{
\dim_set:Nn \l at Funx@Dim { \dim_eval:n { (#1) + (#2) } }
- \Result { \Value \l at Funx@Dim }
+ \Return { \Value \l at Funx@Dim }
}
\PrgNewFunction \DimMathSub { m m }
{
\dim_set:Nn \l at Funx@Dim { \dim_eval:n { (#1) - (#2) } }
- \Result { \Value \l at Funx@Dim }
+ \Return { \Value \l at Funx@Dim }
}
\PrgNewFunction \DimMathSign { m }
{
- \Result { \Expand { \dim_sign:n { #1 } } }
+ \Return { \Expand { \dim_sign:n { #1 } } }
}
\PrgNewFunction \DimMathAbs { m }
{
- \Result { \Expand { \dim_abs:n { #1 } } }
+ \Return { \Expand { \dim_abs:n { #1 } } }
}
\PrgNewFunction \DimMathMax { m m }
{
- \Result { \Expand { \dim_max:nn { #1 } { #2 } } }
+ \Return { \Expand { \dim_max:nn { #1 } { #2 } } }
}
\PrgNewFunction \DimMathMin { m m }
{
- \Result { \Expand { \dim_min:nn { #1 } { #2 } } }
+ \Return { \Expand { \dim_min:nn { #1 } { #2 } } }
}
\PrgNewFunction \DimMathRatio { m m }
{
- \Result { \Expand { \dim_ratio:nn { #1 } { #2 } } }
+ \Return { \Expand { \dim_ratio:nn { #1 } { #2 } } }
}
\PrgNewFunction \DimNew { M } { \dim_new:N #1 }
@@ -1432,7 +1503,7 @@
\PrgNewFunction \DimConst { M m } { \dim_const:Nn #1 {#2} }
-\PrgNewFunction \DimUse { M } { \Result { \Value #1 } }
+\PrgNewFunction \DimUse { M } { \Return { \Value #1 } }
\PrgNewFunction \DimLog { m } { \dim_log:n { #1 } }
@@ -1484,13 +1555,13 @@
\PrgNewConditional \DimIfExist { M }
{
- \dim_if_exist:NTF #1 { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ \dim_if_exist:NTF #1 { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
\PrgNewConditional \DimCompare { m N m }
{
\dim_compare:nNnTF {#1} #2 {#3}
- { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
\PrgNewFunction \DimCase { m m } { \dim_case:nn {#1} {#2} }
@@ -1693,29 +1764,29 @@
\PrgNewConditional \ClistIfExist { M }
{
- \clist_if_exist:NTF #1 { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ \clist_if_exist:NTF #1 { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
\PrgNewConditional \ClistIfEmpty { m }
{
- \clist_if_empty:nTF {#1} { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ \clist_if_empty:nTF {#1} { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
\PrgNewConditional \ClistVarIfEmpty { M }
{
- \clist_if_empty:NTF #1 { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ \clist_if_empty:NTF #1 { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
\PrgNewConditional \ClistIfIn { m m }
{
\clist_if_in:nnTF {#1} {#2}
- { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
\PrgNewConditional \ClistVarIfIn { M m }
{
\clist_if_in:NnTF #1 {#2}
- { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
%%% --------------------------------------------------------
@@ -1950,18 +2021,18 @@
\PrgNewConditional \SeqIfExist { M }
{
- \seq_if_exist:NTF #1 { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ \seq_if_exist:NTF #1 { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
\PrgNewConditional \SeqVarIfEmpty { M }
{
- \seq_if_empty:NTF #1 { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ \seq_if_empty:NTF #1 { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
\PrgNewConditional \SeqVarIfIn { M m }
{
\seq_if_in:NnTF #1 {#2}
- { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
%%% --------------------------------------------------------
@@ -2086,18 +2157,18 @@
\PrgNewConditional \PropIfExist { M }
{
- \prop_if_exist:NTF #1 { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ \prop_if_exist:NTF #1 { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
\PrgNewConditional \PropVarIfEmpty { M }
{
- \prop_if_empty:NTF #1 { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ \prop_if_empty:NTF #1 { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
\PrgNewConditional \PropVarIfIn { M m }
{
\prop_if_in:NnTF #1 {#2}
- { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
%%% --------------------------------------------------------
@@ -2114,6 +2185,32 @@
\PrgNewConditional \QuarkVarIfNoValue { M }
{
\tl_if_eq:NNTF \qNoValue #1
- { \Result { \cTrueBool } } { \Result { \cFalseBool } }
+ { \Return { \cTrueBool } } { \Return { \cFalseBool } }
}
+%%% --------------------------------------------------------
+%%> \section{Interfaces to Legacy Concepts (Legacy)}
+%%% --------------------------------------------------------
+
+\PrgNewConditional \LegacyIf { m }
+ {
+ \legacy_if:nTF {#1} { \Return { \cTrueBool } } { \Return { \cFalseBool } }
+ }
+
+\PrgNewFunction \LegacyIfSetTrue { m }
+ {
+ \__fun_do_assignment:Nnn \c at name
+ { \legacy_if_gset_true:n {#1} } { \legacy_if_set_true:n {#1} }
+ }
+
+\PrgNewFunction \LegacyIfSetFalse { m }
+ {
+ \__fun_do_assignment:Nnn \c at name
+ { \legacy_if_gset_false:n {#1} } { \legacy_if_set_false:n {#1} }
+ }
+
+\PrgNewFunction \LegacyIfSet { m m }
+ {
+ \__fun_do_assignment:Nnn \c at name
+ { \legacy_if_gset:nn {#1} {#2} } { \legacy_if_set:nn {#1} {#2} }
+ }
More information about the tex-live-commits
mailing list.