|
| 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 |
0 commit comments