RosettaCodeData/Task/Executable-library/Perl-6/executable-library-1.pl6

10 lines
215 B
Raku
Raw Permalink Normal View History

2013-04-10 22:43:41 -07:00
module Hailstone {
our sub hailstone($n) is export {
$n, { $_ %% 2 ?? $_ div 2 !! $_ * 3 + 1 } ... 1
}
}
sub MAIN {
say "hailstone(27) = {.[^4]} [...] {.[*-4 .. *-1]}" given Hailstone::hailstone 27;
}