最佳答案
在Swift中有没有对应的flatten
在Scala, Xtend, Groovy, Ruby和co?
var aofa = [[1,2,3],[4],[5,6,7,8,9]]
aofa.flatten() // shall deliver [1,2,3,4,5,6,7,8,9]
当然我可以用reduce来做,但那有点糟糕
var flattened = aofa.reduce(Int[]()){
a,i in var b : Int[] = a
b.extend(i)
return b
}