diff options
| author | Jörg Sommrey <28217714+jo-37@users.noreply.github.com> | 2023-03-11 08:52:54 +0100 |
|---|---|---|
| committer | Jörg Sommrey <28217714+jo-37@users.noreply.github.com> | 2023-03-23 18:03:39 +0100 |
| commit | 4b28575dd229d87f54a0b77620acb9798bc2f313 (patch) | |
| tree | e6d93f85e0b7b978b2caa0804618f7af842c9a66 /challenge-003 | |
| parent | 9f22f5ec3afe85b35d815ad1c6f8606b49e02449 (diff) | |
| download | perlweeklychallenge-club-4b28575dd229d87f54a0b77620acb9798bc2f313.tar.gz perlweeklychallenge-club-4b28575dd229d87f54a0b77620acb9798bc2f313.tar.bz2 perlweeklychallenge-club-4b28575dd229d87f54a0b77620acb9798bc2f313.zip | |
Challenge 003 task 2
Diffstat (limited to 'challenge-003')
| -rwxr-xr-x | challenge-003/jo-37/perl/ch-2.pl | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/challenge-003/jo-37/perl/ch-2.pl b/challenge-003/jo-37/perl/ch-2.pl new file mode 100755 index 0000000000..ae26b799c4 --- /dev/null +++ b/challenge-003/jo-37/perl/ch-2.pl @@ -0,0 +1,19 @@ +#!/usr/bin/perl + +use v5.16; +use warnings; +use List::MoreUtils 'slide'; + + +### Implementation +# First row is a single one. +# In the following rows, each element is the sum of the two elements +# from the row above, where this is embedded between two zeroes. + +main: { + my @row = (1); + for (1 .. shift) { + say "@row"; + @row = slide {$a + $b} 0, @row, 0; + } +} |
