let numbers = [1,2,3,4] let result = numbers.map { $0 + 2 } let result2 = numbers.flatMap { $0 + 2 } print(result,result2) // [3,4,5,6] let numbersCompound = [[1,3],[4,6]]; let flatRes = numbersCompound.flatMap { $0.map{ $0} } let filteredArray = flatRes.filter({$0 > 5})