Skip to content

Instantly share code, notes, and snippets.

@jeremycochoy
Last active May 23, 2019 22:40
Show Gist options
  • Save jeremycochoy/f8d6419d898607f03bafbb7610c81bc6 to your computer and use it in GitHub Desktop.
Save jeremycochoy/f8d6419d898607f03bafbb7610c81bc6 to your computer and use it in GitHub Desktop.
var zippy = ListZipper<String>(from: ["I", "love", "pancakes"])
print(zippy.cursor!) // I
zippy.right() // move to the right
print(zippy.cursor!) // love
zippy.cursor = "hate"
print(zippy.toList().joined(separator: " ")) // I hate pancakes
zippy.remove()
zippy.cursor = "Eat"
print(zippy.toList().joined(separator: " ")) // Eat pancakes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment