From d5bb11e77752f5cd7dda3b0ec1e42032d91ee978 Mon Sep 17 00:00:00 2001 From: Andrew Shitov Date: Mon, 20 Jul 2020 08:53:26 +0200 Subject: ash 070-1 --- challenge-070/ash/raku/ch-1.raku | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 challenge-070/ash/raku/ch-1.raku 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 -- cgit