Issue #4890 has been updated by Yusuke Endoh.

Status changed from Open to Assigned
Assignee changed from Yukihiro Matsumoto to Yutaka HARA
Target version changed from 3.0 to 2.0.0

Congrats, this proposal had an affirmative vote from matz! (See #708)

To avoid bikeshed discussion, I propose that we tentatively commit an
implementation as OP proposed.

I know there are still some issues on the API detail.
But let's discuss about the remained issues with the actual example.
Don't worry, we can change the API until this August.


Yutaka, could you make a patch in C?  Or anyone?

-- 
Yusuke Endoh <mame / tsg.ne.jp>
----------------------------------------
Feature #4890: Enumerable#lazy
https://bugs.ruby-lang.org/issues/4890

Author: Yutaka HARA
Status: Assigned
Priority: Normal
Assignee: Yutaka HARA
Category: core
Target version: 2.0.0


=begin
= Example
Print first 100 primes which are in form of n^2+1 

   require 'prime'
   INFINITY = 1.0 / 0
   p (1..INFINITY).lazy.map{|n| n**2+1}.select{|m| m.prime?}.take(100)

(Example taken from enumerable_lz; thanks @antimon2)

= Description

Enumerable#lazy returns an instance of Enumerable::Lazy.
This is the only method added to the existing bulit-in classes.

Lazy is a subclass of Enumerator, which includes Enumerable.
So you can call any methods of Enumerable on Lazy, except methods like
map, select, etc. are redefined as 'lazy' versions.

= Sample implementation

((<URL:https://gist.github.com/1028609>))
(also attached to this ticket)

=end



-- 
http://bugs.ruby-lang.org/