Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add parens to sort: ... <== sort() <== ...
  • Loading branch information
dwarring committed May 13, 2014
1 parent 90be507 commit 6810fce
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions integration/advent2010-day10.t
Expand Up @@ -8,19 +8,17 @@ my @random-nums = (1..100).pick(*);

my $odds-squared-expected = '1 9 25 49 81 121 169 225 289 361 441 529 625 729 841 961 1089 1225 1369 1521 1681 1849 2025 2209 2401 2601 2809 3025 3249 3481 3721 3969 4225 4489 4761 5041 5329 5625 5929 6241 6561 6889 7225 7569 7921 8281 8649 9025 9409 9801';

#?rakudo skip "RT121843"
my @result;
#?rakudo todo "RT121843"
{
# advent example
my @result;
lives_ok {@result = EVAL q:to"END-CODE"}, 'compiles';
my @odds-squares <== sort <== map { $_ ** 2 } <== grep { $_ % 2 } <== @random-nums;
END-CODE
# Original verison of advent post.
lives_ok {@result = EVAL q[my @odds-squares <== sort <== map { $_ ** 2 } <== grep { $_ % 2 } <== @random-nums]};
is ~@result, $odds-squared-expected, 'left feed';
}

{
# watered down - paramterised sortt
my @odds-squared <== sort {$^a <=> $^b} <== map { $_ ** 2 } <== grep { $_ % 2 } <== @random-nums;
# Current version of advent post
my @odds-squared <== sort() <== map { $_ ** 2 } <== grep { $_ % 2 } <== @random-nums;
is ~@odds-squared, $odds-squared-expected, 'left feed';
}

Expand Down

0 comments on commit 6810fce

Please sign in to comment.