Skip to content

Commit

Permalink
[euler] progress info now printed with --verbose option
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Cochrane committed May 16, 2015
1 parent 22f1c61 commit f0c2694
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions categories/euler/prob105-shlomif.p6
Expand Up @@ -53,15 +53,17 @@ sub is_special_sum_set(@A)
return $ret;
}

my $total_sum = 0;
sub MAIN(:$verbose = False) {
my $total_sum = 0;

for 'sets.txt'.IO.lines -> $l
{
say "Processing $l";
my @set = $l.split(',');
if (is_special_sum_set(@set))
for 'sets.txt'.IO.lines -> $l
{
$total_sum += ([+] @set);
say "Processing $l" if $verbose;
my @set = $l.split(',');
if (is_special_sum_set(@set))
{
$total_sum += ([+] @set);
}
}
$verbose ?? say "Total Sum = $total_sum" !! say $total_sum;
}
say "Total Sum = $total_sum";

0 comments on commit f0c2694

Please sign in to comment.