diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2020-07-20 11:10:43 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-20 11:10:43 +0100 |
| commit | fd00a10caf7788ec7bc40fb0809a66873594995f (patch) | |
| tree | 3482884adf10dae34cc9e6e0abbe5f7c6c6e7ac7 /challenge-070 | |
| parent | 28ca5e2f4486939ef322278dd6b703e7ddfc0fef (diff) | |
| parent | 2aab8aeff815338771651ed91a730ce0cdc2cced (diff) | |
| download | perlweeklychallenge-club-fd00a10caf7788ec7bc40fb0809a66873594995f.tar.gz perlweeklychallenge-club-fd00a10caf7788ec7bc40fb0809a66873594995f.tar.bz2 perlweeklychallenge-club-fd00a10caf7788ec7bc40fb0809a66873594995f.zip | |
Merge pull request #1961 from ash/ash-070
Ash 070
Diffstat (limited to 'challenge-070')
| -rw-r--r-- | challenge-070/ash/blog.txt | 1 | ||||
| -rw-r--r-- | challenge-070/ash/blog1.txt | 1 | ||||
| -rw-r--r-- | challenge-070/ash/raku/ch-1.raku | 22 | ||||
| -rw-r--r-- | challenge-070/ash/raku/ch-2.raku | 14 |
4 files changed, 38 insertions, 0 deletions
diff --git a/challenge-070/ash/blog.txt b/challenge-070/ash/blog.txt new file mode 100644 index 0000000000..21cda69c36 --- /dev/null +++ b/challenge-070/ash/blog.txt @@ -0,0 +1 @@ +https://andrewshitov.com/2020/07/20/raku-challenge-week-70-issue-1/ diff --git a/challenge-070/ash/blog1.txt b/challenge-070/ash/blog1.txt new file mode 100644 index 0000000000..21cda69c36 --- /dev/null +++ b/challenge-070/ash/blog1.txt @@ -0,0 +1 @@ +https://andrewshitov.com/2020/07/20/raku-challenge-week-70-issue-1/ diff --git a/challenge-070/ash/raku/ch-1.raku b/challenge-070/ash/raku/ch-1.raku new file mode 100644 index 0000000000..3e4ba2f7f1 --- /dev/null +++ b/challenge-070/ash/raku/ch-1.raku @@ -0,0 +1,22 @@ +#!/usr/bin/env raku + +# Task 1 from +# https://perlweeklychallenge.org/blog/perl-weekly-challenge-070/ + +# Comments: https://andrewshitov.com/2020/07/20/raku-challenge-week-70-issue-1/ + +my $s = 'perlandraku'; +my $c = 3; +my $o = 4; + +my @s = $s.comb; +for 1..$c -> $x { + my $y = ($x + $o) % $s.chars; + @s[$x, $y] = @s[$y, $x]; +} +$s = @s.join(''); + +say $s; + +# Output: +# pndraerlaku diff --git a/challenge-070/ash/raku/ch-2.raku b/challenge-070/ash/raku/ch-2.raku new file mode 100644 index 0000000000..9da4e74097 --- /dev/null +++ b/challenge-070/ash/raku/ch-2.raku @@ -0,0 +1,14 @@ +#!/usr/bin/env raku + +# Task 2 from +# https://perlweeklychallenge.org/blog/perl-weekly-challenge-070/ + +# Comments: https://andrewshitov.com/2020/07/20/gray-code-in-raku/ + +# Usage: +# $ raku ch-2.raku 4 + +put map {$_ +^ ($_ div 2)}, ^2**@*ARGS[0]; + +# Output for N = 4 (4 bits) +# 0 1 3 2 6 7 5 4 12 13 15 14 10 11 9 8 |
