For example, to return the 10,000th prime number I could write:
require \'prime\' Prime.first(10000).last #=> 104729
But creating a huge
What about this?
Prime.to_enum.with_index(1){|e, i| break e if i == 10000} # => 104729
For enumerators that are not lazy, you probably want to put lazy on the enumerator.
lazy