Skip to content

Instantly share code, notes, and snippets.

@missingfaktor
Created September 14, 2011 11:29
Show Gist options
  • Select an option

  • Save missingfaktor/1216355 to your computer and use it in GitHub Desktop.

Select an option

Save missingfaktor/1216355 to your computer and use it in GitHub Desktop.
Zippers
scala> val z = zipper(Stream(9, 11), 7, Stream(23, 9))
z: scalaz.Zipper[Int] = <zipper>
scala> z.shows
res164: String = [11,9] 7 [23,9]
scala> val z0 = z.tryNext
z0: scalaz.Zipper[Int] = <zipper>
scala> z0.shows
res165: String = [11,9,7] 23 [9]
scala> val z1 = z0.insertLeft(11)
z1: scalaz.Zipper[Int] = <zipper>
scala> z1.shows
res166: String = [11,9,7] 11 [23,9]
scala> val z2 = z1.insertRight(89)
z2: scalaz.Zipper[Int] = <zipper>
scala> z2.shows
res167: String = [11,9,7,11] 89 [23,9]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment