diff options
| author | Mohammad Sajid Anwar <Mohammad.Anwar@yahoo.com> | 2024-02-25 14:52:35 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-25 14:52:35 +0000 |
| commit | a6bf95c1089acaa2b1d85a54ff8bd4ad34e3737e (patch) | |
| tree | fb4ccb7cfce4ccd962565976d21855b77af0a6b4 | |
| parent | f39cba57ad014ddf86eb5bd70b7e4b7bb99a1745 (diff) | |
| parent | 68f3183b4e8aa94483d8333c5584d1cbd174bb4f (diff) | |
| download | perlweeklychallenge-club-a6bf95c1089acaa2b1d85a54ff8bd4ad34e3737e.tar.gz perlweeklychallenge-club-a6bf95c1089acaa2b1d85a54ff8bd4ad34e3737e.tar.bz2 perlweeklychallenge-club-a6bf95c1089acaa2b1d85a54ff8bd4ad34e3737e.zip | |
Merge pull request #9637 from jo-37/contrib
fix typo
| -rwxr-xr-x | challenge-257/jo-37/perl/ch-1.pl | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/challenge-257/jo-37/perl/ch-1.pl b/challenge-257/jo-37/perl/ch-1.pl index 93bd7fb00c..9fbb837765 100755 --- a/challenge-257/jo-37/perl/ch-1.pl +++ b/challenge-257/jo-37/perl/ch-1.pl @@ -27,19 +27,19 @@ EOS ### Input and Output -say sdc(@ARGV); +say stc(@ARGV); ### Implementation -sub sdc { +sub stc { my $l = long @_; my $si = $l->qsorti; cat($si, sequence($l) - $l->($si)->dummy(0)->enumvec) ->xchg(0,1)->qsortvec->((1)); } -sub sdc_full { +sub stc_full { my $l = long @_; ($l < $l->dummy(0))->sumover; } @@ -51,10 +51,10 @@ sub run_tests { SKIP: { skip "examples" unless $examples; - is sdc(5, 2, 1, 6)->unpdl, [2, 1, 0, 3], 'example 1'; - is sdc(1, 2, 0, 3)->unpdl, [1, 2, 0, 3], 'example 2'; - is sdc(0, 1)->unpdl, [0, 1], 'example 3'; - is sdc(9, 4, 9, 2)->unpdl, [2, 1, 2, 0], 'example 4'; + is stc(5, 2, 1, 6)->unpdl, [2, 1, 0, 3], 'example 1'; + is stc(1, 2, 0, 3)->unpdl, [1, 2, 0, 3], 'example 2'; + is stc(0, 1)->unpdl, [0, 1], 'example 3'; + is stc(9, 4, 9, 2)->unpdl, [2, 1, 2, 0], 'example 4'; } @@ -67,11 +67,11 @@ sub run_tests { my $n = 10000; my $l = ($n * random $n)->long; - ok all(sdc_full($l) == sdc($l)), 'cross-check'; + ok all(stc_full($l) == stc($l)), 'cross-check'; cmpthese(0, { - full => sub {sdc_full($l)}, - rank => sub {sdc($l)} + full => sub {stc_full($l)}, + rank => sub {stc($l)} }); } |
