From caef8be004348b8426f7694d75a0f28eeae8b493 Mon Sep 17 00:00:00 2001 From: Jörg Sommrey <28217714+jo-37@users.noreply.github.com> Date: Tue, 23 Jan 2024 20:49:38 +0100 Subject: Solution to task 1 --- challenge-253/jo-37/perl/ch-1.pl | 62 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100755 challenge-253/jo-37/perl/ch-1.pl diff --git a/challenge-253/jo-37/perl/ch-1.pl b/challenge-253/jo-37/perl/ch-1.pl new file mode 100755 index 0000000000..70212982a6 --- /dev/null +++ b/challenge-253/jo-37/perl/ch-1.pl @@ -0,0 +1,62 @@ +#!/usr/bin/perl -s + +use v5.24; +use Test2::V0; + +our ($tests, $examples, $sep); + +run_tests() if $tests || $examples; # does not return + +die < "one.two.three","four.five","six")], + ["one","two","three","four","five","six"], 'example 1'; + is [split_strings('$' => '$perl$$', '$$raku')], + ["perl","raku"], 'example 2'; + } + + SKIP: { + skip "tests" unless $tests; + + is [split_strings(0 => qw(00aa00b00 00c00dd00))], + [qw(aa b c dd)], 'empty fields with zero separator'; + } + + done_testing; + exit; +} -- cgit From e694632f0080c5c498492298bd4d732047178617 Mon Sep 17 00:00:00 2001 From: Jörg Sommrey <28217714+jo-37@users.noreply.github.com> Date: Tue, 23 Jan 2024 20:49:52 +0100 Subject: Solution to task 2 --- challenge-253/jo-37/perl/ch-2.pl | 75 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100755 challenge-253/jo-37/perl/ch-2.pl diff --git a/challenge-253/jo-37/perl/ch-2.pl b/challenge-253/jo-37/perl/ch-2.pl new file mode 100755 index 0000000000..dad11ed26a --- /dev/null +++ b/challenge-253/jo-37/perl/ch-2.pl @@ -0,0 +1,75 @@ +#!/usr/bin/perl -s + +use v5.24; +use Test2::V0 '!float'; +use PDL; +use PDL::NiceSlice; + +our ($tests, $examples); + +run_tests() if $tests || $examples; # does not return + +die <append($m((0))->ndcoords)->qsortveci; +} + + +### Examples and tests + +sub run_tests { + SKIP: { + skip "examples" unless $examples; + + is weakest([ + [1, 1, 0, 0, 0], + [1, 1, 1, 1, 0], + [1, 0, 0, 0, 0], + [1, 1, 0, 0, 0], + [1, 1, 1, 1, 1] + ])->unpdl, [2, 0, 3, 1, 4], 'example 1'; + + is weakest([ + [1, 0, 0, 0], + [1, 1, 1, 1], + [1, 0, 0, 0], + [1, 0, 0, 0] + ])->unpdl, [0, 2, 3, 1], 'example 2'; + } + + SKIP: { + skip "tests" unless $tests; + + is weakest([0, 1, 2, 3], + [1, 0, 0, 0], + [1, 2, 3, 4], + [0, 1, 2, 3], + [1, 2, 3, 5])->unpdl, [0, 3, 1, 2, 4], 'arbitrary matrix'; + } + + done_testing; + exit; +} -- cgit From 9c954b5c695398156fb82b1a5cd3e7c8d3d446d1 Mon Sep 17 00:00:00 2001 From: Jörg Sommrey <28217714+jo-37@users.noreply.github.com> Date: Tue, 23 Jan 2024 20:50:47 +0100 Subject: Blog for challenge 253 --- challenge-253/jo-37/blog.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 challenge-253/jo-37/blog.txt diff --git a/challenge-253/jo-37/blog.txt b/challenge-253/jo-37/blog.txt new file mode 100644 index 0000000000..906fab4611 --- /dev/null +++ b/challenge-253/jo-37/blog.txt @@ -0,0 +1 @@ +https://github.sommrey.de/blog/pwc/challenge-253 -- cgit