Mastering macOS Programming
上QQ阅读APP看书,第一时间看更新

Using arrays to create new arrays

These methods do not mutate the array, but return new ones:

let tail = arr.dropFirst() 
let truncated = arr.dropLast()
let fragment = arr.dropFirst(3)
let rearFragment = arr.dropLast(3)