langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
9
Task/Executable-library/Perl-6/executable-library-1.pl6
Normal file
9
Task/Executable-library/Perl-6/executable-library-1.pl6
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
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;
|
||||
}
|
||||
1
Task/Executable-library/Perl-6/executable-library-2.pl6
Normal file
1
Task/Executable-library/Perl-6/executable-library-2.pl6
Normal file
|
|
@ -0,0 +1 @@
|
|||
$ perl6 Hailstone.pm
|
||||
3
Task/Executable-library/Perl-6/executable-library-3.pl6
Normal file
3
Task/Executable-library/Perl-6/executable-library-3.pl6
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
use Hailstone;
|
||||
my %score; %score{hailstone($_).elems}++ for 1 .. 100_000;
|
||||
say "Most common lengh is {.key}, occuring {.value} times." given max :by(*.value), %score;
|
||||
Loading…
Add table
Add a link
Reference in a new issue