2 ms·
I think that only half avoids it, or shifts the wrong side of the big O to opposite of wherever it is now. select! also mutates in place. But I'm not totally
by yebyen 10y ago
I think that only half avoids it, or shifts the wrong side of the big O to opposite of wherever it is now. select! also mutates in place.
But I'm not totally sure about that, after reading the Rubydoc for Array[1], only reject! has the warning about mutating the array every time the block is called, select! does not have any such warning. You might be right.
[1]: https://ruby-doc.org/core-2.2.0/Array.html#method-i-reject-21 https://ruby-doc.org/core-2.2.0/Array.html#method-i-reject-2...