Skip to content

Commit 2de324d

Browse files
committed
improves the section about the Sum set function
1 parent bced028 commit 2de324d

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

spec/index.html

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9701,16 +9701,17 @@ <h5>Sum</h5>
97019701
be 6.0 (float).</p>
97029702
<div class="defn">
97039703
<p><b>Definition: <span id="defn_aggSum">Sum</span></b></p>
9704-
<pre class="code nohighlight">numeric Sum(sequence S)</pre>
9705-
<p>L = Flatten(S)</p>
9706-
<p>Sum(S) = Sum(L)</p>
9707-
<p>Sum(L) = op:numeric-add(L<sub>1</sub>, Sum(L<sub>2..n</sub>)) if <a href="#defn_Card">Card</a>(L) &gt;
9704+
<pre class="code nohighlight">numeric <var>Sum</var>(sequence <var>S</var>)</pre>
9705+
<p>|Sum|(|S|) = <var>Sum'</var>(|L|),
9706+
where |L| = Flatten(|S|)
9707+
and <var>Sum'</var>(|L|) is defined recursively as follows.</p>
9708+
<p><var>Sum'</var>(|L|) = op:numeric-add(|L|<sub>1</sub>, <var>Sum'</var>(|L|<sub>2..n</sub>)) if <a href="#defn_Card">Card</a>(|L|) &gt;
97089709
1<br>
9709-
Sum(L) = op:numeric-add(L<sub>1</sub>, 0) if <a href="#defn_Card">Card</a>(L) = 1<br>
9710-
Sum(L) = "0"^^xsd:integer if <a href="#defn_Card">Card</a>(L) = 0</p>
9711-
<p>In this way, Sum( (1, 2, 3) ) = op:numeric-add(1, op:numeric-add(2,
9712-
op:numeric-add(3, 0))).</p>
9710+
<var>Sum'</var>(|L|) = op:numeric-add(|L|<sub>1</sub>, 0) if <a href="#defn_Card">Card</a>(|L|) = 1<br>
9711+
<var>Sum'</var>(|L|) = "0"^^xsd:integer if <a href="#defn_Card">Card</a>(|L|) = 0</p>
97139712
</div>
9713+
<p>In this way, <var>Sum</var>( [(1), (2), (3)] ) = <var>Sum'</var>( (1, 2, 3) ) =
9714+
op:numeric-add(1, op:numeric-add(2, op:numeric-add(3, 0))).</p>
97149715
</section>
97159716
<section id="aggAvg">
97169717
<h5>Avg</h5>

0 commit comments

Comments
 (0)