Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def xrange(lo: Int, hi: Int): Stream[Int] = {
- println(lo)
- if(lo >= hi) Stream.empty
- else Stream.cons(lo, xrange(lo + 1, hi))
- }
- (xrange(0, 10).count(_ <= 3) >= 3)
- outputnya:
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- res0: Boolean = true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement