Skip to content

Commit 5b8e85c

Browse files
committed
Documents RaceSeq, some fixes and adds to type-graph.txt closes #1897
1 parent a305a94 commit 5b8e85c

File tree

3 files changed

+87
-1
lines changed

3 files changed

+87
-1
lines changed

doc/Type/HyperSeq.pod6

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Applies C<grep> to the C<HyperSeq> similarly to how it would do it on a Seq.
2929
=for code
3030
my @hyped = (^10000).map(*²).hyper;
3131
@hyped.grep( * %% 3 ).say;
32-
# OUTPUT: «(0 9 36 81 144
32+
# OUTPUT: «(0 9 36 81 144…»
3333
3434
When you use C<hyper> on a C<Seq>, this is the method that is actually called.
3535

doc/Type/RaceSeq.pod6

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
=begin pod
2+
3+
=TITLE class RaceSeq
4+
5+
=SUBTITLE Performs batches of work in parallel without respecting original
6+
order.
7+
8+
class RaceSeq does Iterable does Sequence { }
9+
10+
An RaceSeq is the intermediate object used when the operator
11+
L<C<race>|/routine/race> is invoked on a L<C<Seq>|/type/Seq>. In general,
12+
it's not intended for direct consumption by the developer.
13+
14+
=head1 Methods
15+
16+
17+
=head2 method iterator
18+
19+
method iterator(RaceSeq:D: --> Iterator:D)
20+
21+
Returns the underlying iterator.
22+
23+
=head2 method grep
24+
25+
method grep(RaceSeq:D: $matcher, *%options)
26+
27+
Applies C<grep> to the C<RaceSeq> similarly to how it would do it on a Seq.
28+
29+
=for code
30+
my @raced = (^10000).map(*²).race;
31+
@raced.grep( * %% 3 ).say;
32+
# OUTPUT: «(0 9 36 81 144 …»
33+
34+
When you use C<race> on a C<Seq>, this is the method that is actually called.
35+
36+
=head2 method map
37+
38+
method map(RaceSeq:D: $matcher, *%options)
39+
40+
Uses maps on the C<RaceSeq>, generally created by application of C<.race> to
41+
a preexisting C<Seq>.
42+
43+
=head2 method invert
44+
45+
method invert(RaceSeq:D:)
46+
47+
Inverts the C<RaceSeq> created from a C<Seq> by C<.race>.
48+
49+
=head2 method race
50+
51+
method race(RaceSeq:D:)
52+
53+
Returns the object.
54+
55+
=head2 method hyper
56+
57+
method hyper(RaceSeq:D:)
58+
59+
Creates a C<HyperSeq> object out of the current one.
60+
61+
=head2 method serial
62+
63+
multi method serial(RaceSeq:D:)
64+
65+
Converts the object to a C<Seq> and returns it.
66+
67+
=head2 method is-lazy
68+
69+
method is-lazy(--> False )
70+
71+
Returns C<False>.
72+
73+
74+
=head2 method sink
75+
76+
Defined as:
77+
78+
method sink(--> Nil)
79+
80+
Sinks the underlying data structure, producing any side effects.
81+
82+
=end pod
83+
84+
# vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6

type-graph.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,8 @@ role Iterable
210210
role Iterator
211211
role PositionalBindFailover
212212
class Seq is Cool does Iterable does PositionalBindFailover
213+
class RaceSeq does Iterable does Sequence
214+
class HyperSeq does Iterable does Sequence
213215

214216
[Composite]
215217
# Collections: Positional

0 commit comments

Comments
 (0)