4 ms·
Avoiding this should be as simple as using the inverse, `select!`, and then flipping whatever the check is in the block, right?
by Dirlewanger 10y ago
Avoiding this should be as simple as using the inverse, `select!`, and then flipping whatever the check is in the block, right?
- deleted 10y ago[deleted]
- yebyen 10y agoI 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...