Created
January 19, 2015 19:05
-
-
Save dinks/df762aba5368130d3bb8 to your computer and use it in GitHub Desktop.
Ruby infinites collections
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
# Always use lazy! | |
(0..3).lazy.cycle.map {|x| x * 10}.take(5).to_a | |
# Without lazy, the program wont stop! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment