Skip to content

Commit c2a9d2f

Browse files
committed
Library should return value for printing
... instead of printing it out
1 parent e669505 commit c2a9d2f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

bin/sudoku

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ use App::SudokuHelper;
66
my %*SUB-MAIN-OPTS = :named-anywhere;
77

88
sub MAIN("combo", Int $sum, Int $count?, Str :$n is copy = "", Bool :s(:$sandwich)=False, Bool :$sequence, Bool :$x=False) {
9-
MAIN-handler-combo($sum, $count, :$n, :$sandwich, :$sequence, :$x);
9+
say MAIN-handler-combo($sum, $count, :$n, :$sandwich, :$sequence, :$x);
1010
}

lib/App/SudokuHelper.rakumod

+4-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ our sub MAIN-handler-combo(Int $sum, Int $count?, Str :$n is copy = "", Bool :s(
1313

1414
my @digits = (1..9).grep({ not $n.comb.grep($_)});
1515

16+
my @retvals;
17+
1618
for @counts -> $length {
1719
# need a copy for -x work below
1820
for @digits.combinations($length) -> $combo is copy {
@@ -36,7 +38,8 @@ our sub MAIN-handler-combo(Int $sum, Int $count?, Str :$n is copy = "", Bool :s(
3638
$combo = $c.List;
3739
}
3840
}
39-
say $combo.join(' ');
41+
@retvals.push: $combo.join(' ');
4042
}
4143
}
44+
return @retvals.join("\n");
4245
}

0 commit comments

Comments
 (0)