diff options
| author | Luis F. Uceta <uzluisf@protonmail.com> | 2019-05-17 09:19:02 -0400 |
|---|---|---|
| committer | Luis F. Uceta <uzluisf@protonmail.com> | 2019-05-17 09:19:02 -0400 |
| commit | d8fc09b123e4727a4558554b1ffd5dc921cd2ea8 (patch) | |
| tree | 2c3fa46f6ce8a965420cbac4c6c74da870b07f76 /challenge-008 | |
| parent | 031169005aa1c9ec59b199e6c1ce87555e04ceff (diff) | |
| download | perlweeklychallenge-club-d8fc09b123e4727a4558554b1ffd5dc921cd2ea8.tar.gz perlweeklychallenge-club-d8fc09b123e4727a4558554b1ffd5dc921cd2ea8.tar.bz2 perlweeklychallenge-club-d8fc09b123e4727a4558554b1ffd5dc921cd2ea8.zip | |
Remove return of sorted strings
Strings were being returned in ascending order but they don't need to. They
keep the same ordering in which they were passed in.
Diffstat (limited to 'challenge-008')
| -rw-r--r-- | challenge-008/uzluisf/perl6/ch-2.p6 | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/challenge-008/uzluisf/perl6/ch-2.p6 b/challenge-008/uzluisf/perl6/ch-2.p6 index 5eb95dde4f..c69ad6543d 100644 --- a/challenge-008/uzluisf/perl6/ch-2.p6 +++ b/challenge-008/uzluisf/perl6/ch-2.p6 @@ -10,9 +10,8 @@ return the modified lines. =end comment sub center( *@strings --> List ) { - my @sorted = @strings.sort({.chars}); - my $max-len = @sorted.tail.chars; - return @sorted.map({ + my $max-len = @strings.sort({.chars}).tail.chars; + return @strings.map({ ( ' ' x (.chars - $max-len).abs div 2, $_).join }).list; } |
