aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Shitov <andy@shitov.ru>2020-07-20 08:53:26 +0200
committerAndrew Shitov <andy@shitov.ru>2020-07-20 08:53:26 +0200
commitd5bb11e77752f5cd7dda3b0ec1e42032d91ee978 (patch)
tree12d7eac6bd1589f5c35400c984a1353a91fa1b97
parent0624537a1f36a9c9fdab487b6a47c23b9a54e421 (diff)
downloadperlweeklychallenge-club-d5bb11e77752f5cd7dda3b0ec1e42032d91ee978.tar.gz
perlweeklychallenge-club-d5bb11e77752f5cd7dda3b0ec1e42032d91ee978.tar.bz2
perlweeklychallenge-club-d5bb11e77752f5cd7dda3b0ec1e42032d91ee978.zip
ash 070-1
-rw-r--r--challenge-070/ash/raku/ch-1.raku22
1 files changed, 22 insertions, 0 deletions
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