unfold_example1
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