2015-03-23 15:11:35 -04:00
|
|
|
<?xml version="1.0"?>
|
2015-03-18 13:32:24 -04:00
|
|
|
<!--
|
2020-03-06 11:05:18 -05:00
|
|
|
Copyright (C) 2014-2020 Ryan Specialty Group, LLC.
|
2015-03-18 13:32:24 -04:00
|
|
|
|
|
|
|
This file is part of tame-core.
|
|
|
|
|
|
|
|
tame-core is free software: you can redistribute it and/or modify it
|
2018-01-26 11:13:33 -05:00
|
|
|
under the terms of the GNU General Public License as
|
2015-03-18 13:32:24 -04:00
|
|
|
published by the Free Software Foundation, either version 3 of the
|
|
|
|
License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
-->
|
2015-03-18 11:31:47 -04:00
|
|
|
<package xmlns="http://www.lovullo.com/rater"
|
2015-03-23 15:11:35 -04:00
|
|
|
xmlns:c="http://www.lovullo.com/calc"
|
|
|
|
core="true"
|
|
|
|
desc="Base features">
|
2013-02-13 09:27:33 -05:00
|
|
|
|
2015-03-23 15:11:35 -04:00
|
|
|
The \pkgself~package exposes common and internal
|
|
|
|
defintions. Ideally, this package will be included automatically by
|
|
|
|
the compiler to remove repetitive, boilerplate imports. Importing
|
|
|
|
this package isn't necessary if none of these definitions are
|
|
|
|
needed.
|
2013-02-13 09:27:33 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
2015-03-23 15:11:35 -04:00
|
|
|
<section title="Internal Constants">
|
|
|
|
\ref{_CMATCH_} is a magic constant that contains the result of
|
|
|
|
a~classification match. This is used implicity by
|
|
|
|
\ref{rate-each}.\footnote{The symbol is \Xi~because it looks like
|
|
|
|
a sideways array.}
|
2013-02-13 09:27:33 -05:00
|
|
|
|
2015-03-23 15:11:35 -04:00
|
|
|
\todo{Remove in favor of a local variable or generated
|
|
|
|
classification; there is no need (anymore) for this to be magic.}
|
2013-02-13 09:27:33 -05:00
|
|
|
|
2015-03-23 15:11:35 -04:00
|
|
|
<const name="_CMATCH_" type="boolean" sym="\Xi"
|
2017-12-22 11:14:29 -05:00
|
|
|
desc="Classification match vector (applicability)">
|
2015-03-23 15:11:35 -04:00
|
|
|
<item value="0"
|
|
|
|
desc="Dummy value; this set is populated upon entering
|
|
|
|
each rate block" />
|
|
|
|
</const>
|
2013-02-13 09:27:33 -05:00
|
|
|
|
|
|
|
|
2015-03-23 15:11:35 -04:00
|
|
|
The runtime is responsible for populating \ref{__DATE_YEAR__} with
|
|
|
|
a proper value representing the current year.
|
2013-02-13 09:27:33 -05:00
|
|
|
|
2015-03-23 15:11:35 -04:00
|
|
|
\todo{TAME is deterministic with this one exception; remove it and
|
2017-04-04 10:29:24 -04:00
|
|
|
have users use the params from {\tt datetime} instead if they need this
|
|
|
|
datum.}
|
2013-02-13 09:27:33 -05:00
|
|
|
|
2015-03-23 15:11:35 -04:00
|
|
|
<const name="__DATE_YEAR__" magic="true"
|
|
|
|
value="0" type="integer"
|
|
|
|
desc="Current year"
|
|
|
|
sym="\widehat{D^\gamma}" />
|
|
|
|
</section>
|
2013-02-13 09:27:33 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
2015-03-23 15:11:35 -04:00
|
|
|
<section title="Primitive Types">
|
|
|
|
Primitives are defined internally; these definitions simply
|
|
|
|
provide symbols to permit their use.
|
2013-02-13 09:27:33 -05:00
|
|
|
|
2015-03-23 15:11:35 -04:00
|
|
|
<typedef name="integer"
|
|
|
|
desc="Any value in the set of integers"
|
|
|
|
sym="\mathbb{I}">
|
|
|
|
<base-type />
|
|
|
|
</typedef>
|
2013-02-13 09:27:33 -05:00
|
|
|
|
|
|
|
|
2015-03-23 15:11:35 -04:00
|
|
|
<typedef name="float"
|
|
|
|
desc="Any real number (represented as a float)"
|
|
|
|
sym="\mathbb{R}">
|
|
|
|
<base-type />
|
|
|
|
</typedef>
|
2013-02-13 09:27:33 -05:00
|
|
|
|
|
|
|
|
2015-03-23 15:11:35 -04:00
|
|
|
\ref{empty} does not have much use outside of the compiler.
|
|
|
|
|
|
|
|
<typedef name="empty"
|
|
|
|
desc="Empty set"
|
|
|
|
sym="\emptyset">
|
|
|
|
<base-type />
|
|
|
|
</typedef>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
2018-07-12 16:41:03 -04:00
|
|
|
<section title="Boolean and Unknown">
|
|
|
|
\ref{boolean} contains the boolean \ref{TRUE} and~\ref{FALSE} values,
|
|
|
|
which map to~$1$ and~$0$ respectively.
|
|
|
|
The \ref{maybe} type is the union of \ref{boolean} and \ref{NOTHING},
|
|
|
|
with a value of~$-1$;\footnote{
|
|
|
|
This is similar in spirit to the Haskell \tt{Maybe} type,
|
|
|
|
or the OCaml \tt{Option} type.
|
|
|
|
}this is commonly used to represent an unknown state or missing
|
|
|
|
value.\footnote{
|
|
|
|
The \ref{nothing}~type is used for the sake of the union;
|
|
|
|
it should not be used directly.}
|
|
|
|
|
|
|
|
<typedef name="maybe" desc="Boolean or unknown value">
|
|
|
|
<union>
|
|
|
|
<typedef name="nothing" desc="Unknown value">
|
|
|
|
<enum type="integer">
|
|
|
|
<item name="NOTHING" value="-1" desc="Unknown or missing value" />
|
|
|
|
</enum>
|
|
|
|
</typedef>
|
|
|
|
|
|
|
|
<typedef name="boolean" desc="Boolean values">
|
|
|
|
<enum type="integer">
|
|
|
|
<item name="TRUE" value="1" desc="True" />
|
|
|
|
<item name="FALSE" value="0" desc="False" />
|
|
|
|
</enum>
|
|
|
|
</typedef>
|
|
|
|
</union>
|
|
|
|
</typedef>
|
|
|
|
|
|
|
|
The constant \ref{UNKNOWN} is also defined as~$-1$ to serve as an
|
|
|
|
alternative to the term~``nothing''.
|
|
|
|
|
|
|
|
<const name="UNKNOWN" value="-1"
|
|
|
|
desc="Unknown or missing value" />
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
2015-03-23 15:11:35 -04:00
|
|
|
|
|
|
|
<section title="Convenience">
|
2015-03-24 13:48:11 -04:00
|
|
|
$0$~is a~common value. Where a value is required (such
|
2015-03-23 15:11:35 -04:00
|
|
|
as a~template argument), \ref{ZERO} may be used. TAME now
|
|
|
|
supports a~constant-scalar syntax ({\tt #0}; \todo{reference this
|
|
|
|
in documentation}), making this largely unnecessary.
|
|
|
|
|
|
|
|
This is declared as a float to provide compatibility with all
|
|
|
|
types of expressions.
|
|
|
|
|
|
|
|
<const name="ZERO" value="0.00"
|
|
|
|
desc="Zero value" />
|
|
|
|
|
|
|
|
|
|
|
|
In the case where classifications are required, but a~static
|
|
|
|
assumption about the applicability of the subject can be made, we
|
|
|
|
have values that are always~true and always~false. The use
|
|
|
|
of~\ref{never} may very well be a~code smell, but let us not rush
|
|
|
|
to judgment.\footnote{\ref{never} has been added as an analog
|
|
|
|
to~\ref{always}; its author has never had use for it. Oh, look,
|
|
|
|
we just used ``never''.}
|
|
|
|
|
|
|
|
<classify as="always"
|
|
|
|
desc="Always true"
|
|
|
|
yields="alwaysTrue"
|
|
|
|
keep="true" />
|
|
|
|
|
|
|
|
<classify as="never"
|
2015-04-29 15:23:04 -04:00
|
|
|
any="true"
|
2015-03-23 15:11:35 -04:00
|
|
|
desc="Never true"
|
|
|
|
yields="neverTrue"
|
|
|
|
keep="true" />
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<section title="Work-In-Progress">
|
2018-01-25 16:16:34 -05:00
|
|
|
\ref{_todo_} formalizes TODO items and may optionally yield a
|
|
|
|
value~\tt{@value@} for use within calculations.%
|
|
|
|
\footnote{This is different than its previous behavior of always
|
|
|
|
yielding a scalar~$0$.}
|
|
|
|
All uses of the \ref{_todo_} template will produce a warning composed of
|
|
|
|
its description~\tt{@desc@}.
|
2015-03-23 15:11:35 -04:00
|
|
|
|
|
|
|
<template name="_todo_"
|
|
|
|
desc="Represents work that needs to be done">
|
|
|
|
<param name="@desc@" desc="TODO desc">
|
|
|
|
<text>TODO</text>
|
|
|
|
</param>
|
|
|
|
|
2018-01-25 16:16:34 -05:00
|
|
|
<param name="@value@" desc="Placeholder value" />
|
|
|
|
<param name="@index@" desc="Placeholder value index">
|
|
|
|
<text></text>
|
|
|
|
</param>
|
2015-03-23 15:11:35 -04:00
|
|
|
|
2018-01-25 16:16:34 -05:00
|
|
|
<unless name="@value@">
|
|
|
|
<unless name="@index@" eq="">
|
|
|
|
<error>Using @index@ without @value@</error>
|
|
|
|
</unless>
|
2015-03-23 15:11:35 -04:00
|
|
|
</unless>
|
2018-01-25 16:16:34 -05:00
|
|
|
|
|
|
|
|
|
|
|
<warning>
|
|
|
|
TODO: <param-value name="@desc@" />
|
|
|
|
</warning>
|
|
|
|
|
|
|
|
|
|
|
|
<if name="@value@">
|
|
|
|
<c:value-of name="@value@" index="@index@" />
|
|
|
|
</if>
|
2015-03-23 15:11:35 -04:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
The \ref{_ignore_} template serves as a~block
|
|
|
|
comment.\footnote{This is useful since XML does not support nested
|
|
|
|
comments, which makes it difficult to comment out code that
|
|
|
|
already has XML comments.} It may be useful for debugging, but is
|
|
|
|
discouraged for use otherwise. The \ref{_ignore_/@desc@} param
|
|
|
|
should be used to describe intent.
|
|
|
|
|
|
|
|
<template name="_ignore_"
|
|
|
|
desc="Removes all child nodes (as if commented out)">
|
|
|
|
<param name="@values@" desc="Nodes to comment out" />
|
|
|
|
<param name="@desc@" desc="Reason for ignore" />
|
|
|
|
|
2018-01-26 11:15:27 -05:00
|
|
|
|
|
|
|
<warning>Ignored block!</warning>
|
2015-03-23 15:11:35 -04:00
|
|
|
</template>
|
|
|
|
</section>
|
2020-04-13 09:03:31 -04:00
|
|
|
|
|
|
|
<template name="_yield_"
|
|
|
|
desc="Final scalar result provided to caller">
|
|
|
|
<param name="@values@" desc="Yield calculation" />
|
|
|
|
|
|
|
|
<rate yields="___yield" local="true">
|
|
|
|
<param-copy name="@values@" />
|
|
|
|
</rate>
|
|
|
|
</template>
|
2020-04-13 18:58:49 -04:00
|
|
|
|
|
|
|
<template name="_rate-each_"
|
|
|
|
desc="Convenience template that expands to a lv:rate block summing over
|
|
|
|
the magic _CMATCH_ set with the product of its value">
|
|
|
|
<param name="@values@"
|
|
|
|
desc="Yield calculation" />
|
|
|
|
|
|
|
|
<param name="@generates@" desc="Generator name (optional)">
|
|
|
|
<text></text>
|
|
|
|
</param>
|
|
|
|
|
|
|
|
<param name="@yields@" desc="Yield (optional)">
|
|
|
|
<text>_</text>
|
|
|
|
<param-value name="@generates@" />
|
|
|
|
</param>
|
|
|
|
|
|
|
|
<!-- at least one of generates or yields is required -->
|
|
|
|
<if name="@yields@" eq="">
|
|
|
|
<if name="@generates@" eq="">
|
|
|
|
<error>must provide at least one of @generates or @yields</error>
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
|
|
|
|
<param name="@class@"
|
|
|
|
desc="Space-delimited classifications for predicated iteration" />
|
|
|
|
<param name="@no@"
|
|
|
|
desc="Space-delimited classifications for predicated iteration to prevent matches">
|
|
|
|
<text></text>
|
|
|
|
</param>
|
|
|
|
|
|
|
|
<param name="@index@"
|
|
|
|
desc="Generator index" />
|
|
|
|
|
|
|
|
<param name="@dim@" desc="Dim (optional)">
|
|
|
|
<text></text>
|
|
|
|
</param>
|
|
|
|
|
|
|
|
<param name="@gensym@" desc="Generator TeX symbol">
|
|
|
|
<text></text>
|
|
|
|
</param>
|
|
|
|
|
|
|
|
<rate class="@class@" no="@no@" yields="@yields@"
|
|
|
|
gentle-no="true"
|
|
|
|
desc="Total {@yields@} premium">
|
|
|
|
<c:sum of="_CMATCH_" dim="@dim@" sym="@gensym@"
|
|
|
|
generates="@generates@" index="@index@"
|
|
|
|
desc="Set of individual {@yields@} premiums">
|
|
|
|
<c:product>
|
|
|
|
<c:value-of name="_CMATCH_" index="@index@"
|
|
|
|
label="One if {@class@} and not {@no@} (if provided), otherwise zero" />
|
|
|
|
<param-copy name="@values@" />
|
|
|
|
</c:product>
|
|
|
|
</c:sum>
|
|
|
|
</rate>
|
|
|
|
</template>
|
2015-03-18 11:31:47 -04:00
|
|
|
</package>
|
2013-02-13 09:27:33 -05:00
|
|
|
|