Skip to content

Commit 45a2c98

Browse files
Code0x58sparkprime
authored andcommitted
Emphasise set requirements (#599)
1 parent 8612fd5 commit 45a2c98

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

doc/ref/stdlib.html

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,6 +1568,11 @@ <h3 id="sets">Sets</h3>
15681568
<div class="hgroup-inline">
15691569
<div class="panel">
15701570
<p>Sets are represented as ordered arrays without duplicates.</p>
1571+
<p>
1572+
Note that the <code>std.set*</code> functions rely on the uniqueness and ordering
1573+
on arrays passed to them to work. This can be guarenteed by using <code>std.set(arr)<code>.
1574+
If that is not the case, the functions will quietly return non-meaningful results.
1575+
</p>
15711576
</div>
15721577
<div style="clear: both"></div>
15731578
</div>
@@ -1625,10 +1630,14 @@ <h4 id="setUnion">std.setUnion(a, b)</h4>
16251630
<div class="hgroup-inline">
16261631
<div class="panel">
16271632
<p>
1628-
Set union operation (values in either a or b). Note that + on sets will simply concatenate
1629-
the arrays, possibly forming an array that is not a set (due to not bein ordered without
1633+
Set union operation (values in any of <code>a</code> or <code>b</code>). Note that + on sets will simply concatenate
1634+
the arrays, possibly forming an array that is not a set (due to not being ordered without
16301635
duplicates).
16311636
</p>
1637+
<p>
1638+
Example1: <code>std.setUnion([1, 2], [2, 3])</code> yields
1639+
<code>[1, 2, 3]</code>.
1640+
</p>
16321641
</div>
16331642
<div style="clear: both"></div>
16341643
</div>

0 commit comments

Comments
 (0)