🔬47. Push-all optimisation of List.roll in Perl 6

Last evening, I made a commit based on my recent observation. Let me devote today’s post to that.

In the last few days, we were talking about the two methods for getting random elements from a list — pick and roll. When you pass an integer to the methods, both of them internally use an instance of the class implementing the Iterator role. Depending on the situation, either pull-one or push-all method is called on that object.

Just as a reminder, here’s the skeleton of the two methods from src/core/List.pm (the samples are not working code):