The Weekly Challenge Advent Calendar 2022
Mohammad Sajid Anwar

Mohammad Sajid Anwar @manwar

About: 2022 White Camel Awardee. CPAN Contributor. Co-editor of Perl Weekly newsletter. Run The Weekly Challenge. Father of 3 angels. Indian by birth, British by choice.

Location:
London, England
Joined:
Nov 24, 2022

The Weekly Challenge Advent Calendar 2022

Publish Date: Dec 18 '22
5 4

|   2019   |   2020   |   2021   |   2022   |


Welcome to our 4th Advent Calendar. I promise to present interesting topic every day contributed by esteemed members of Team PWC.


MON
TUE
WED
THU
FRI
SAT
SUN









Day 1
1
Day 2
2
Day 3
3
Day 4
4
Day 5
5
Day 6
6
Day 7
7
Day 8
8
Day 9
9
Day 10
10
Day 11
11
Day 12
12
Day 13
13
Day 14
14
Day 15
15
Day 16
16
Day 17
17
Day 18
18
Day 19
19
Day 20
20
Day 21
21
Day 22
22
Day 23
23
Day 24
24

25


26


27


28


29


30


31




Comments 4 total

  • Yuki Kimoto
    Yuki KimotoDec 20, 2022

    Could I join the the weekly challenge using SPVM in this comment?

    • Mohammad Sajid Anwar
      Mohammad Sajid AnwarDec 22, 2022

      Certainly, feel free.

      • Yuki Kimoto
        Yuki KimotoDec 22, 2022

        Thanks. I will try an example.

      • Yuki Kimoto
        Yuki KimotoDec 23, 2022

        I tried Day 5 Farey Sequence using SPVM.

        theweeklychallenge.org/blog/advent...

        # SPVM/FareySequence.spvm
        class FareySequence {
          use DoubleList;
          use Fn;
          use Sort;
        
          static method farey_sequence : void ($n : int) {
            my $fs_list = DoubleList->new([(double)0/1, 1/1]);
        
            for (my $numerator = 1; $numerator < $n; $numerator++) {
              for (my $denominator = $numerator + 1; $denominator < $n + 1; $denominator++) {
                $fs_list->push((double)$numerator / $denominator);
              }
            }
        
            my $fs = $fs_list->to_array;
            Sort->sort_double_asc($fs);
        
            say dump $fs;
          }
        }
        
        Enter fullscreen mode Exit fullscreen mode
        # farey_sequence.pl
        use strict;
        use warnings;
        
        use FindBin;
        use lib "$FindBin::Bin";
        
        use SPVM 'FareySequence';
        
        SPVM::FareySequence->farey_sequence(5);
        
        Enter fullscreen mode Exit fullscreen mode

        Output:

        [
          0,
          0.2,
          0.25,
          0.333333,
          0.4,
          0.5,
          0.5,
          0.6,
          0.666667,
          0.75,
          0.8,
          1
        ] : double[](0x5652e2536340)
        
        Enter fullscreen mode Exit fullscreen mode
Add comment