From: "nobu (Nobuyoshi Nakada)" Date: 2013-02-19T15:26:22+09:00 Subject: [ruby-dev:47045] [ruby-trunk - Feature #7877] E::Lazy#with_index needed Issue #7877 has been updated by nobu (Nobuyoshi Nakada). File 0001-enumerator.c-Enumerator-Lazy-with_index.patch added Description updated ---------------------------------------- Feature #7877: E::Lazy#with_index needed https://bugs.ruby-lang.org/issues/7877#change-36599 Author: shyouhei (Shyouhei Urabe) Status: Assigned Priority: Normal Assignee: yhara (Yutaka HARA) Category: core Target version: next minor =begin なんかLazyの有効な例を出そうと思ってそうだライプニッツ級数だ!ということで def leibniz(n) (0..Float::INFINITY).lazy.with_index {|i, j| (-1 ** j) / (2*i+1).to_f }.take(n).reduce(:+) end とかやっても動かない(いや動くけど。止まらん)。残念です。これあったほうが便利じゃないですかね。どうでしょう。 あ、もちろん2.0.0以降でOKです。 =end -- http://bugs.ruby-lang.org/