Skip to content

Instantly share code, notes, and snippets.

@jeremycochoy
Created May 23, 2019 22:12
Show Gist options
  • Save jeremycochoy/144387a65f1496af5723ab7fd69f83b6 to your computer and use it in GitHub Desktop.
Save jeremycochoy/144387a65f1496af5723ab7fd69f83b6 to your computer and use it in GitHub Desktop.
/// Select the left element if available
mutating func left() {
guard leftList.isNotEmpty else {return}
if let c = cursor {rightList.append(c)}
cursor = leftList.popLast()
}
/// Select the right element if available
mutating func right() {
guard rightList.isNotEmpty else {return}
if let c = cursor {leftList.append(c)}
cursor = rightList.popLast()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment