def extract!(array)
      out = []
      array.reject! do |e|
        next false unless yield e
        out << e
        true
      end
      out
    end
def extract!(array)
      out = []
      array.reject! do |e|
        next false unless yield e
        out << e
        true
      end
      out
    end
Destructively removes all elements from an array that match a block, and
 returns the removed elements.

 @param array [Array] The array from which to remove elements.
 @yield [el] Called for each element.
 @yieldparam el [*] The element to test.
 @yieldreturn [Boolean] Whether or not to extract the element.
 @return [Array] The extracted elements.