Rules / Types, classes & roles / basic
HyperWhatever Reference
Placeholder for multiple unspecified values/arguments
What it is #
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 no-output · 3 ok · 1 rakupp-differs
class HyperWhatever { }Not executed: the documentation states no expected output for this example.
sub foo ($arg) { say $arg.^name }
foo **; # OUTPUT: «HyperWhatever»Output
HyperWhatever
Documentation, Rakudo and Raku++ all agree.
say (1, 8) ~~ (1, **, 8); # OUTPUT: «True» say (1, 2, 4, 5, 6, 7, 8) ~~ (1, **, 8); # OUTPUT: «True» say (1, 2, 8, 9) ~~ (1, **, 8); # OUTPUT: «False»
Output
True
True
False
Documentation, Rakudo and Raku++ all agree.
say (**²)(1, 2, 3, 4, 5); # OUTPUT: «(1 4 9 16 25)»
Documentation
(1 4 9 16 25)
Rakudo
(1 4 9 16 25)
Raku++
Raku++ disagrees with both the documentation and Rakudo — a defect.
my &hyper-whatever = sub (*@args) { map *², @args }
say hyper-whatever(1, 2, 3, 4, 5); # OUTPUT: «(1 4 9 16 25)»Output
(1 4 9 16 25)
Documentation, Rakudo and Raku++ all agree.