Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make List.keys many times faster on finite lists
  • Loading branch information
lizmat committed Oct 2, 2015
1 parent e19a521 commit e3717ef
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/core/List.pm
Expand Up @@ -461,7 +461,9 @@ my class List does Iterable does Positional { # declared in BOOTSTRAP
Seq.new(self.iterator)
}
multi method keys(List:D:) {
self.values.map: { (state $)++ }
self.is-lazy
?? self.values.map: { (state $)++ }
!! Range.new( 0, self.elems - 1 )
}
multi method kv(List:D:) {
gather self.values.map: {
Expand Down

0 comments on commit e3717ef

Please sign in to comment.