Array = {}

Array.detect = function(list, func)
    for index = 1, #list do
        if func(list[index]) then
            return list[index]
        end
    end
end

Array.filter = function(list, func)
    local result = {}
    for index = 1, #list do
        if func(list[index]) then
            result[#result + 1] = list[index]
        end
    end
    return result
end

Array.map = function(list, func)
    local result = {}
    for index = 1, #list do
        result[index] = func(list[index])
    end
    return result
end

return Array
