diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2020-12-20 01:42:22 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-20 01:42:22 +0000 |
| commit | 8628df766da82395f3ce241cd9cd84b78b49a3e7 (patch) | |
| tree | 7323988dab4802a28bfdf813ec2b278a9914389a | |
| parent | 8503dc5936c2dbd8e990ac86030b1e34cfe51a5d (diff) | |
| parent | 1c56d627264052d3b3d3babbb9214822ad807f06 (diff) | |
| download | perlweeklychallenge-club-8628df766da82395f3ce241cd9cd84b78b49a3e7.tar.gz perlweeklychallenge-club-8628df766da82395f3ce241cd9cd84b78b49a3e7.tar.bz2 perlweeklychallenge-club-8628df766da82395f3ce241cd9cd84b78b49a3e7.zip | |
Merge pull request #3006 from jo-37/contrib
Use appropriate type for piddle indices
| -rwxr-xr-x | challenge-089/jo-37/perl/ch-2.pl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/challenge-089/jo-37/perl/ch-2.pl b/challenge-089/jo-37/perl/ch-2.pl index b08d40b377..22bb8f7c83 100755 --- a/challenge-089/jo-37/perl/ch-2.pl +++ b/challenge-089/jo-37/perl/ch-2.pl @@ -11,11 +11,11 @@ sub siamese { my $n = shift; my $ord = 2 * $n + 1 ; my $msq = zeroes(long, $ord, $ord)->inplace->setvaltobad(0); - my $idx = long $n, 0; + my $idx = indx $n, 0; for my $val (1 .. $ord ** 2) { $msq->range($idx, 0, 'periodic') .= $val; say $msq if $::verbose; - $idx += $val % $ord ? long(1, -1) : long(0, 1); + $idx += $val % $ord ? indx(1, -1) : indx(0, 1); } # Return order, magic constant and magic square ($ord, ($ord**3 + $ord) / 2, $msq); |
