Skip to content

Instantly share code, notes, and snippets.

@dinks
Created January 19, 2015 19:05
Show Gist options
  • Save dinks/df762aba5368130d3bb8 to your computer and use it in GitHub Desktop.
Save dinks/df762aba5368130d3bb8 to your computer and use it in GitHub Desktop.
Ruby infinites collections
# 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