Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Move combination sub to the GLR.
  • Loading branch information
colomon committed Aug 28, 2015
1 parent 3177163 commit 60232eb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions integration/99problems-21-to-30.t
Expand Up @@ -114,18 +114,18 @@ sub combination($n, @xs) {
if $n > @xs {
()
} elsif $n == 0 {
([])
([],)
} elsif $n == @xs {
[@xs]
([@xs],)
} else {
(map { [@xs[0],$_.list] },combination($n-1,@xs[1..*])), combination($n,@xs[1..*])
combination($n-1, @xs[1..*]).map({ [@xs[0], |$_ ] }).Slip, combination($n, @xs[1..*]).Slip;
}
}

#?niecza skip 'hangs'
{

is combination(3, (1..5)),
is combination(3, (1..5)).perl,
([1, 2, 3],
[1, 2, 4],
[1, 2, 5],
Expand All @@ -135,7 +135,7 @@ sub combination($n, @xs) {
[2, 3, 4],
[2, 3, 5],
[2, 4, 5],
[3, 4, 5]), "combinations work.";
[3, 4, 5]).perl, "combinations work.";
}

#?niecza skip 'hangs'
Expand Down

0 comments on commit 60232eb

Please sign in to comment.