Ruby reverse.each_with_index and delete_at causing problems in latest Ruby/Rails
问题 So, I'm well aware of the perils of removing items in an iteration block (this is looping in reverse), and I know Matz mentioned something about mutations in iterations causing stability problems, but I can't seem to figure this one out. This example is a little convoluted and I'm not sure even solving it will replicate the example exactly, but I'll have to try. arr1 = [1, 2, 3, 4, 5] arr2 = [3, 4, 5] puts arr1.inspect puts arr2.inspect arr2.each do |i| arr1.reverse.each_with_index do |j,