Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

implement List.combinations(Range $)

  • Loading branch information...
commit 5e56c98fb18c79bc4d3ba0d22c366ce20a29f424 1 parent 1371ccc
@grondilu grondilu authored timo committed
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/core/List.pm
View
5 src/core/List.pm
@@ -547,7 +547,10 @@ my class List does Positional { # declared in BOOTSTRAP
gather take self[@$_] for combinations self.elems, $of
}
multi method combinations( Range $of = 0 .. * ) {
- X::NYI.new.throw;
+ gather for @$of {
+ last if $_ > self.elems;
+ take self.combinations($_);
+ }
}
my sub permutations(Int $n) {
Please sign in to comment.
Something went wrong with that request. Please try again.