Created
February 8, 2014 16:48
-
-
Save windymelt/8886521 to your computer and use it in GitHub Desktop.
unfold_example1
This file contains 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
import scalaz.std.stream._ | |
import scalaz.syntax.id._ | |
unfold(0)(failable(_).map(_.squared)).force // => Stream(1, 2, 3, 4, 5, ..., 99, 100) | |
unfold(0)(failable(_).map(n => (s"n=${n}", n))).force // => Stream("n=1", "n=2", ... "n=100") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment