module Enumerable
    # Check if every element returns true
    def every
        each do |value|
            result = yield(value)
            return false unless result
        end
        return true
    end
    
    # Check if at least one element returns true
    def some
        each do |value|
            result = yield(value)
            return true if result
        end
        return false
    end
    
    # Return two arrays, one with elements that satisfy the test,
    # and another that fail the test
    def partition_if
        pass, fail = [], []
        each do |value|
            result = yield(value)
            if result then pass.push(value)
            else           fail.push(value)
            end
        end
        return pass, fail
    end
    
end
