I used... Raku


I used Raku for a casual program.

Which, even by future me standards, should not be a big deal, as I have already used Raku a lot in the past year and a half, with two Advent of Codes and multiple The Weekly Challenges.

So… what’s the difference here?

Well, I guess that more or less for the first time this was not because I specifically wanted to use Raku, for learning etc., but just because I had to solve a little problem and I figured… why not?

The problem itself was quite trivial: given a list of dates, find the longest uninterrupted streak. Here’s what I came up with, in an admittedly strongly accented implementation:

#!/usr/bin/env raku
use v6;
sub MAIN {
   my @dates = $*IN.lines;
   my $start = my $previous = Date.new(@dates.shift);
   my $n = 1;
   for @dates -> $datestr {
      my $current = Date.new($datestr);
      if $current - $previous > 1 {
         $n = 1;
         $start = $current;
      else {
      $previous = $current;

I hope you too have -Ofun using Raku!

Comments? Octodon, , GitHub, Reddit, or drop me a line!