From f384737b6467805602da8a1be4c957e0d137778c Mon Sep 17 00:00:00 2001 From: Jörg Sommrey <28217714+jo-37@users.noreply.github.com> Date: Tue, 2 Jul 2024 20:37:56 +0200 Subject: Solution to task 1 --- challenge-276/jo-37/perl/ch-1.pl | 65 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100755 challenge-276/jo-37/perl/ch-1.pl diff --git a/challenge-276/jo-37/perl/ch-1.pl b/challenge-276/jo-37/perl/ch-1.pl new file mode 100755 index 0000000000..0883bc8b11 --- /dev/null +++ b/challenge-276/jo-37/perl/ch-1.pl @@ -0,0 +1,65 @@ +#!/usr/bin/perl -s + +use v5.24; +use Test2::V0 '!float'; +use PDL; + +our ($tests, $examples); + +run_tests() if $tests || $examples; # does not return + +die < Date: Tue, 2 Jul 2024 20:38:09 +0200 Subject: Solution to task 2 --- challenge-276/jo-37/perl/ch-2.pl | 68 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100755 challenge-276/jo-37/perl/ch-2.pl diff --git a/challenge-276/jo-37/perl/ch-2.pl b/challenge-276/jo-37/perl/ch-2.pl new file mode 100755 index 0000000000..40c1c23c22 --- /dev/null +++ b/challenge-276/jo-37/perl/ch-2.pl @@ -0,0 +1,68 @@ +#!/usr/bin/perl -s + +use v5.24; +use Test2::V0; +use List::Util 'reduce'; + +our ($tests, $examples); + +run_tests() if $tests || $examples; # does not return + +die < $maxfreq] + }() + } 0, @_; +} + + +### Examples and tests + +sub run_tests { + SKIP: { + skip "examples" unless $examples; + + is max_freq(1, 2, 2, 4, 1, 5), 4, 'example 1'; + is max_freq(1, 2, 3, 4, 5), 5, 'example 2'; + } + + SKIP: { + skip "tests" unless $tests; + + is max_freq(qw(a b a b c d c d e f e f e c a)), 9, 'non-numbers' + } + + done_testing; + exit; +} -- cgit From 7f2a9ae475a295aa638f05023ea9260151164912 Mon Sep 17 00:00:00 2001 From: Jörg Sommrey <28217714+jo-37@users.noreply.github.com> Date: Tue, 2 Jul 2024 20:38:32 +0200 Subject: Blog for challenge 276 --- challenge-276/jo-37/blog.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 challenge-276/jo-37/blog.txt diff --git a/challenge-276/jo-37/blog.txt b/challenge-276/jo-37/blog.txt new file mode 100644 index 0000000000..4d33530d05 --- /dev/null +++ b/challenge-276/jo-37/blog.txt @@ -0,0 +1 @@ +https://github.sommrey.de/the-bears-den/2024/07/05/ch-276.html -- cgit