HyperSeq Reference
An object for performing batches of work in parallel with ordered
What it is #
Routines #
Signatures are reproduced from the documentation, including their declared return types. A routine listed here is part of the type's published interface; whether Raku++ implements it is a separate question, answered by the examples below.
method iterator #
method iterator(HyperSeq:D: --> Iterator:D)
Returns Iterator:D.
Returns the underlying iterator.
method grep #
method grep(HyperSeq:D: $matcher, *%options)
Applies grep to the HyperSeq similarly to how it would do it on a Seq. When you use hyper on a Seq, this is the method that is actually called.
method map #
method map(HyperSeq:D: $matcher, *%options)
Uses maps on the HyperSeq, generally created by application of hyper to a preexisting Seq.
method invert #
method invert(HyperSeq:D:)
Inverts the HyperSeq created from a Seq by .hyper.
method hyper #
method hyper(HyperSeq:D:)
Returns the object.
method race #
method race(HyperSeq:D:)
Creates a RaceSeq object out of the current one.
method serial #
multi method serial(HyperSeq:D:)
Converts the object to a Seq and returns it.
method is-lazy #
method is-lazy(--> False )
Returns False.
Returns False.
method sink #
method sink(--> Nil)
Returns Nil.
Sinks the underlying data structure, producing any side effects.
Examples, run three ways #
Every example below comes from the official documentation, together with the output that documentation asserts. Each was then executed by Rakudo and by Raku++ when this page was built. Where the three agree, one result is shown; where they do not, all three are — because which of them is wrong is exactly the information worth having.
1 doc-drift · 1 no-output
class HyperSeq does Iterable does Sequence { }Not executed: the documentation states no expected output for this example.
my @hyped = (^10000).map(*²).hyper; @hyped.grep( * %% 3 ).say; # OUTPUT: «(0 9 36 81 144 ...)»
(0 9 36 81 144 ...)
(0 9 36 81 144 225 324 441 576 729 900 1089 1296 1521 1764 2025 2304 2601 2916 3249 3600 3969 4356 4761 5184 5625 6084 6561 7056 7569 8100 8649 9216 9801 10404 11025 11664 12321 12996 13689 14400 15129 15876 16641 17424 18225 19044 19881 20736 21609 22500 23409 24336 25281 26244 27225 28224 29241 30276 31329 32400 33489 34596 35721 36864 38025 39204 40401 41616 42849 44100 45369 46656 47961 49284 50625 51984 53361 54756 56169 57600 59049 60516 62001 63504 65025 66564 68121 69696 71289 72900 74529 76176 77841 79524 81225 82944 84681 86436 88209 ...)
(0 9 36 81 144 225 324 441 576 729 900 1089 1296 1521 1764 2025 2304 2601 2916 3249 3600 3969 4356 4761 5184 5625 6084 6561 7056 7569 8100 8649 9216 9801 10404 11025 11664 12321 12996 13689 14400 15129 15876 16641 17424 18225 19044 19881 20736 21609 22500 23409 24336 25281 26244 27225 28224 29241 30276 31329 32400 33489 34596 35721 36864 38025 39204 40401 41616 42849 44100 45369 46656 47961 49284 50625 51984 53361 54756 56169 57600 59049 60516 62001 63504 65025 66564 68121 69696 71289 72900 74529 76176 77841 79524 81225 82944 84681 86436 88209 ...)
Both engines agree; the documentation states something else. Trust the engines.