💾 Archived View for sdf.org › van.ly › raku-challenges.gmi captured on 2023-12-28 at 15:45:58. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
This document, Revision 0.0.1 αβγ of Red Slip, uses the following Amd64, NetBSD, Emacs, Figlet, Gemini Protocol, Git, Graphviz, Texinfo Tool & Technique.
© Copyright Van Ly 2023–2053
Undecided.
_/_/_/ _/ _/_/_/ _/ _/ _/ _/ _/_/ _/_/_/ _/ _/ _/_/_/ _/_/_/ _/_/_/_/ _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/_/ _/_/_/ _/_/_/ _/ _/ _/_/_/ _/ _/
_____ _ _____ ___ | __| |___ ___ ___ _ _ | __|_ _ ___| _|___ ___ ___ | | | | .'|_ -|_ -| | | |__ | | | _| _| .'| _| -_| |_____|_|__,|___|___|_ | |_____|___|_| |_| |__,|___|___| |___|
Raku Weekly Challenge
001 Challenge
1 #!/usr/bin/env raku 2 # -*- mode: raku; -*- 3 4 use v6; 5 6 my $string = "Perl Weekly Challenge"; 7 8 # challenge 1: upcase 'e', count 'e' 9 10 say $string.subst(/e/, "E", :g); 11 for $string.split("") -> $e { if "e" ~~ $e { $counter++; } } 12 say 'counter: ' ~ $counter; 13 14 # challenge 2: solve fizzbuzz ranging 1 to 20 15 16 for 1..20 -> $e { if 0 == $e mod 3 && 0 == $e mod 5 { say 'fizzbuzz'; } elsif 0 == $e mod 3 { say 'fizz'; } elsif 0 == $e mod 5 { say 'buzz'; } else { say "$e"; }}
001 Output
1 PErl WEEkly ChallEngE 2 counter: 5 3 1 4 2 5 3 fizz 6 4 7 5 buzz 8 6 fizz 9 7 10 8 11 9 fizz 12 10 buzz 13 11 14 12 fizz 15 13 16 14 17 15 fizzbuzz 18 16 19 17 20 18 fizz 21 19 22 20 buzz