Advertisement
Guest User

Untitled

a guest
Nov 18th, 2014
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.23 KB | None | 0 0
  1. def xrange(lo: Int, hi: Int): Stream[Int] = {
  2. println(lo)
  3. if(lo >= hi) Stream.empty
  4. else Stream.cons(lo, xrange(lo + 1, hi))
  5. }
  6. (xrange(0, 10).count(_ <= 3) >= 3)
  7.  
  8. outputnya:
  9. 0
  10. 1
  11. 2
  12. 3
  13. 4
  14. 5
  15. 6
  16. 7
  17. 8
  18. 9
  19. 10
  20. res0: Boolean = true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement