Actually, another direct implication of using .first is this: Code: enum Animal (Cat => 0, Dog => 0, Human => 42); say Dog.succ
Result: Dog So it's not just the algorithmic complexity, and we need a test for that. On 2017-09-14 17:47:59, alex.jakime...@gmail.com wrote: > Source code: > https://github.com/rakudo/rakudo/blob/nom/src/core/Enumeration.pm#L36- > L45 > > The problem is with this line: > my $index = @values.first( self, :k ); > > Basically, .first will iterate through the elements, but I guess it is > possible to store the index of the current enum value and simply > increment/decrement it when needed. > > Some discussion here: > https://github.com/rakudo/rakudo/pull/1156#issuecomment-329640201 > > I think this ticket is closable without tests once the change is > implemented.