Created
September 14, 2011 11:29
-
-
Save missingfaktor/1216355 to your computer and use it in GitHub Desktop.
Zippers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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