1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* enumerator.c (enumerable_lazy): fix the documentation of

Enumerable#lazy.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shugo 2012-03-14 16:00:30 +00:00
parent 0562e3ff40
commit 552adf8c5b
2 changed files with 13 additions and 4 deletions

View file

@ -1,3 +1,8 @@
Thu Mar 15 00:58:04 2012 Shugo Maeda <shugo@ruby-lang.org>
* enumerator.c (enumerable_lazy): fix the documentation of
Enumerable#lazy.
Wed Mar 14 22:01:06 2012 Shugo Maeda <shugo@ruby-lang.org>
* enumerator.c (lazy_init_iterator): break when Qundef is returned

View file

@ -1209,12 +1209,13 @@ lazy_initialize(VALUE self, VALUE obj)
* e.lazy -> lazy_enumerator
*
* Returns a lazy enumerator, whose methods map/collect,
* flat_map/collect_concat, select/find_all, reject, and grep call blocks
* only on an as-needed basis.
* flat_map/collect_concat, select/find_all, reject, grep, zip, take,
* take_while, drop, and drop_while enumerate values only on an as-needed
* basis.
*
* === Example
*
* The following program shows all pythagorean triples less than 100:
* The following program finds pythagorean triples:
*
* def pythagorean_triples
* (1..Float::INFINITY).lazy.flat_map {|z|
@ -1227,7 +1228,10 @@ lazy_initialize(VALUE self, VALUE obj)
* }
* }
* end
* p pythagorean_triples.take_while { |x, y, z| z < 100 }
* # show first ten pythagorean triples
* p pythagorean_triples.take(10).force
* # show pythagorean triples less than 100
* p pythagorean_triples.take_while { |*, z| z < 100 }.force
*/
static VALUE
enumerable_lazy(VALUE obj)