parent
0094a3b94a
commit
b256744c32
|
@ -99,17 +99,7 @@
|
||||||
|
|
||||||
|
|
||||||
<section title="Convenience">
|
<section title="Convenience">
|
||||||
Negation is a common task and it was tedious in older versions of
|
$0$~is a~common value. Where a value is required (such
|
||||||
TAME\footnote{Before it was even called TAME, actually.} For
|
|
||||||
these situations, \ref{NEGATE} is provided to avoid having to use
|
|
||||||
a~\ref{const} expression.
|
|
||||||
|
|
||||||
<const name="NEGATE" value="-1"
|
|
||||||
desc="Negate a value"
|
|
||||||
sym="-" />
|
|
||||||
|
|
||||||
|
|
||||||
Similarly, $0$~is a~common value. Where a value is required (such
|
|
||||||
as a~template argument), \ref{ZERO} may be used. TAME now
|
as a~template argument), \ref{ZERO} may be used. TAME now
|
||||||
supports a~constant-scalar syntax ({\tt #0}; \todo{reference this
|
supports a~constant-scalar syntax ({\tt #0}; \todo{reference this
|
||||||
in documentation}), making this largely unnecessary.
|
in documentation}), making this largely unnecessary.
|
||||||
|
|
|
@ -26,54 +26,85 @@
|
||||||
<import package="../base" />
|
<import package="../base" />
|
||||||
|
|
||||||
|
|
||||||
<template name="_inc_" desc="Increment value [by 1]">
|
|
||||||
<param name="@values@" desc="Value to increment (nodes)" />
|
|
||||||
|
|
||||||
<param name="@value@" desc="Value to decrement by (default 1)">
|
<section title="Stepping">
|
||||||
<text>1</text>
|
Due to the declarative nature of~TAME, recursive operations
|
||||||
</param>
|
needing to step are~not all that common. These operations are
|
||||||
|
useful when converting between 1-indexed and 0-indexed data.
|
||||||
|
|
||||||
<c:sum>
|
\ref{_inc_} increments a value by a~single step (default~1).
|
||||||
<param-copy name="@values@" />
|
|
||||||
<c:const value="@value@" type="integer" desc="Increment by 1" />
|
<template name="_inc_"
|
||||||
</c:sum>
|
desc="Increment value [by 1]">
|
||||||
</template>
|
<param name="@values@" desc="Value to increment (nodes)" />
|
||||||
|
|
||||||
|
<param name="@value@" desc="Value to decrement by (default 1)">
|
||||||
|
<text>1</text>
|
||||||
|
</param>
|
||||||
|
|
||||||
|
|
||||||
|
<c:sum>
|
||||||
|
<param-copy name="@values@" />
|
||||||
|
|
||||||
|
<c:const value="@value@"
|
||||||
|
desc="Increment by 1" />
|
||||||
|
</c:sum>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
\ref{_dec_} decrements a value by a~single step (default~1).
|
||||||
|
|
||||||
|
<template name="_dec_"
|
||||||
|
desc="Decrement value [by 1]">
|
||||||
|
<param name="@values@" desc="Value to decrement (nodes)" />
|
||||||
|
|
||||||
|
<param name="@value@" desc="Value to decrement by (default 1)">
|
||||||
|
<text>1</text>
|
||||||
|
</param>
|
||||||
|
|
||||||
|
|
||||||
|
<c:sum>
|
||||||
|
<param-copy name="@values@" />
|
||||||
|
|
||||||
|
<t:negate>
|
||||||
|
<c:const value="@value@"
|
||||||
|
desc="Decrement by 1" />
|
||||||
|
</t:negate>
|
||||||
|
</c:sum>
|
||||||
|
</template>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<template name="_dec_" desc="Decrement value [by 1]">
|
<section title="Negation">
|
||||||
<param name="@values@" desc="Value to decrement (nodes)" />
|
Negation is a common task and it was tedious in older versions of
|
||||||
|
TAME\footnote{Before it was even called TAME, actually.} For
|
||||||
|
these situations, \ref{NEGATE} is provided to avoid having to use
|
||||||
|
a~\ref{const} expression. To avoid a {\tt product} expression
|
||||||
|
altogether, use~\ref{_negate_}.
|
||||||
|
|
||||||
<param name="@value@" desc="Value to decrement by (default 1)">
|
<const name="NEGATE" value="-1"
|
||||||
<text>1</text>
|
desc="Negate a value"
|
||||||
</param>
|
sym="-" />
|
||||||
|
|
||||||
|
|
||||||
<c:sum>
|
<template name="_negate_"
|
||||||
<param-copy name="@values@" />
|
desc="Negate an expression">
|
||||||
|
<param name="@values@" desc="Expression to negate" />
|
||||||
|
<param name="@label@" desc="Application label (default empty)">
|
||||||
|
<text></text>
|
||||||
|
</param>
|
||||||
|
|
||||||
<c:product>
|
<c:product label="@label@">
|
||||||
<c:value-of name="NEGATE" />
|
<c:value-of name="NEGATE" />
|
||||||
<c:const value="@value@" type="integer" desc="Decrement by 1" />
|
<param-copy name="@values@" />
|
||||||
</c:product>
|
</c:product>
|
||||||
</c:sum>
|
</template>
|
||||||
</template>
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<template name="_negate_" desc="Negate a value">
|
<!-- Everything below this line must be moved. -->
|
||||||
<param name="@values@" desc="Value to decrement (nodes)" />
|
|
||||||
<param name="@label@" desc="Application label">
|
|
||||||
<!-- default empty -->
|
|
||||||
<text></text>
|
|
||||||
</param>
|
|
||||||
|
|
||||||
<c:product label="@label@">
|
|
||||||
<c:value-of name="NEGATE" />
|
|
||||||
<param-copy name="@values@" />
|
|
||||||
</c:product>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<template name="_percent-of_" desc="Take percentage of a value">
|
<template name="_percent-of_" desc="Take percentage of a value">
|
||||||
|
|
Loading…
Reference in New Issue