Skip to content

Commit 99d9074

Browse files
committed
Reflow, add Introduction header, fix some typoes
1 parent 2434c44 commit 99d9074

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

doc/Language/setbagmix.pod6

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,31 @@
44
55
=SUBTITLE Unordered collections of unique and weighted objects in Perl 6
66
7+
=head1 Introduction
8+
9+
The six collection classes are L<Set|/type/Set>, L<SetHash|/typ[e/SetHash>,
10+
L<Bag|/type/Bag>, L<BagHash|/type/BagHash>, L<Mix|/type/Mix> and
11+
L<MixHash:/type/MixHash>. They all share similar semantics.
12+
713
In a nutshell, these classes hold, in general, unordered collections of
814
objects, much like an L<object hash|hashmap#index-entry-object_hash>.
915
The L<QuantHash|/type/QuantHash> role is the role that is implemented by all
1016
of these classes: therefore they are also referenced as C<QuantHash>es.
1117
18+
C<Set> and C<SetHash> also implement the L<Setty|/type/Setty> role,
19+
C<Bag> and C<BagHash> implement the L<Baggy|/type/Baggy> role, C<Mix> and
20+
C<MixHash> implement the L<Mixy|/type/Mixy> role (which itself implements
21+
the C<Baggy> role).
22+
1223
Sets only consider if objects in the collection are present or not, bags can
1324
hold several objects of the same kind, and mixes also allow fractional (and
1425
negative) weights. The regular versions are immutable, the I<Hash> versions
1526
are mutable.
1627
17-
Let's elaborate on that. If you want to collect objects in a container buti
18-
you do not care about the order of these objects, Perl 6 provides the
19-
I<unordered> collection types L<Set|/type/Set>,
20-
L<SetHash|/type/SetHash>, L<Bag|/type/Bag>, L<BagHash|/type/BagHash>,
21-
L<Mix|/type/Mix>, and L<MixHash|/type/MixHash>. Being unordered, these
22-
containers can be more efficient than L<Lists|/type/List> for looking up
28+
Let's elaborate on that. If you want to collect objects in a container but
29+
you do not care about the order of these objects, Perl 6 provides these
30+
I<unordered> collection types. Being unordered, these containers can be more
31+
efficient than L<Lists|/type/List> or L<Arrays|/type/Array> for looking up
2332
elements or dealing with repeated items.
2433
2534
On the other hand, if you want to get the contained objects (elements)
@@ -49,12 +58,6 @@ Use the mutable variants L<SetHash|/type/SetHash>, L<BagHash|/type/BagHash>,
4958
and L<MixHash|/type/MixHash> if you want to add or remove elements after the
5059
container has been constructed.
5160
52-
The six collection classes C<Set>, C<SetHash>, C<Bag>, C<BagHash>, C<Mix>,
53-
C<MixHash>, all share similar semantics. C<Set> and C<SetHash> implement
54-
the L<Setty|/type/Setty> role, C<Bag> and C<BagHash> implement the
55-
L<Baggy|/type/Baggy> role, C<Mix> and C<MixHash> implement the
56-
L<Mixy|/type/Mixy> role (which implements the C<Baggy> role).
57-
5861
For one thing, as far as they are concerned, identical objects refer to the
5962
same element – where identity is determined using the L<WHICH|/routine/WHICH>
6063
method (i.e. the same way that the L<===> operator checks identity). For value

0 commit comments

Comments
 (0)