📅  最后修改于: 2022-03-11 15:01:01.599000             🧑  作者: Mango
extension Array {
subscript(circular index: Int) -> Element? {
guard index >= 0 && !isEmpty else { return nil }
guard index >= count else { return self[index] }
return self[index % count]
}
}