/**
/ reduce
parameter xs: <#xs description#>
returns: <#return value description#>
/
func sumUsingReduce(xs: [Int]) -> Int {
return xs.reduce(10) { result, xx in return result + xx }
}
func sumUsingReduce(xs: [Int]) -> Int {
return xs.reduce(10 ,combine: + )
}
func productUsingReduce(xs: [Int]) -> Int {
return xs.reduce(1, combine: )
}
func concatUsingReduce(xs: [String]) -> String {
return xs.reduce("", combine: +)
}
/**
\ map
parameter xs: <#xs description#>
parameter transform: <#transform description#>
returns: <#return value description#>
*/
func genericComputeArray<T>(xs: [Int], transform: Int -> T) - > [T] {
return xs.map(transform)
}
/**
filterr
parameter files: <#files description#>
returns: <#return value description#>
*/
func getSwiftFiles2(files: [String]) -> [String] {
return files.filter { file in file.hasSuffix(".swift") }
}