aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJörg Sommrey <28217714+jo-37@users.noreply.github.com>2020-12-19 11:12:51 +0100
committerJörg Sommrey <28217714+jo-37@users.noreply.github.com>2020-12-19 11:13:43 +0100
commit1c56d627264052d3b3d3babbb9214822ad807f06 (patch)
tree7323988dab4802a28bfdf813ec2b278a9914389a
parent8503dc5936c2dbd8e990ac86030b1e34cfe51a5d (diff)
downloadperlweeklychallenge-club-1c56d627264052d3b3d3babbb9214822ad807f06.tar.gz
perlweeklychallenge-club-1c56d627264052d3b3d3babbb9214822ad807f06.tar.bz2
perlweeklychallenge-club-1c56d627264052d3b3d3babbb9214822ad807f06.zip
Use appropriate type for piddle indices
-rwxr-xr-xchallenge-089/jo-37/perl/ch-2.pl4
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);