高阶函数、closure闭包、curry柯里化
// 8-3 结尾闭包(traling closure)和 捕获数值(Capture Values) import UIKit var strArr = ["d","cd","bcd","abcd","abc","ab","a"] sorted(strArr,{(s1,s2) in if countElements(s1) != countElements(s2) { return countElements(s1) < countElements(s2) } return s1 < s2 }) //trailing closure sorted(strArr){(s1,s2) in if countElements(s1) != countElements(s2) { return countElements(s1) < countElements(s2) } return s1 < s2 }