diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2019-11-10 18:57:51 +0000 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2019-11-10 18:57:51 +0000 |
| commit | 753ddb20fb0b90c30a2b7d2ae0dc7219da12320a (patch) | |
| tree | 5f8994bbfab77c166fdb6fc5017c1d7534295fe4 /challenge-033 | |
| parent | f0ac60842e3a5629788cd1c1d6ae880a1942d4ac (diff) | |
| parent | da04bd4174b39d163d0ea5f4b0fe9297a3b95983 (diff) | |
| download | perlweeklychallenge-club-753ddb20fb0b90c30a2b7d2ae0dc7219da12320a.tar.gz perlweeklychallenge-club-753ddb20fb0b90c30a2b7d2ae0dc7219da12320a.tar.bz2 perlweeklychallenge-club-753ddb20fb0b90c30a2b7d2ae0dc7219da12320a.zip | |
Merge branch 'master' of git://github.com/holli-holzer/perlweeklychallenge-club into holli-holzer-master
Diffstat (limited to 'challenge-033')
| -rw-r--r-- | challenge-033/markus-holzer/perl6/ch-2.p6 | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/challenge-033/markus-holzer/perl6/ch-2.p6 b/challenge-033/markus-holzer/perl6/ch-2.p6 index abe1fdd28c..42113bf6e3 100644 --- a/challenge-033/markus-holzer/perl6/ch-2.p6 +++ b/challenge-033/markus-holzer/perl6/ch-2.p6 @@ -1,21 +1,21 @@ # this works for all n -sub MAIN( $n = 11 ) +sub MAIN( Int $n = 11 ) { my $ln = ( $n * $n ).Str.chars + 1; my $li = $n.chars + 1; - header( $n ); - line( $_, $n ) for ( 1 .. $n ); + header; + line $_ for ( 1 .. $n ); - sub line( $i, $n ) + sub line( $i ) { - my @n = ( ( $i .. $n ) X* $n ).map({ sprintf( "%{$ln}s", $_ ) }); + my @n = ( ( $i .. $n ) X* $i ).map({ sprintf( "%{$ln}s", $_ ) }); my @e = ( ' ' xx ( $ln * ( $i - 1 ) ) ); say sprintf( "%{$li}s", $i ), '|', @e.join, @n.join; } - sub header( $n ) + sub header { my @h = ( 1 .. $n ).map({ sprintf( "%{$ln}s", $_ ) }); say sprintf( "%{$li}s", "x" ), '|', @h.join; |
