From: nobu@ruby-lang.org
To: ruby-dev@ruby-lang.org
Subject: [ruby-dev:50831] [Ruby master Bug#7877] E::Lazy#with_index should be lazy
Date: Fri, 09 Aug 2019 08:07:19 +0000 (UTC) [thread overview]
Message-ID: <redmine.journal-80515.20190809080718.783979356436323c@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-7877.20130218202740@ruby-lang.org
Issue #7877 has been updated by nobu (Nobuyoshi Nakada).
Assignee changed from nobu (Nobuyoshi Nakada) to jeremyevans0 (Jeremy Evans)
Description updated
Thank you, I've missed it.
----------------------------------------
Bug #7877: E::Lazy#with_index should be lazy
https://bugs.ruby-lang.org/issues/7877#change-80515
* Author: shyouhei (Shyouhei Urabe)
* Status: Assigned
* Priority: Normal
* Assignee: jeremyevans0 (Jeremy Evans)
* Target version:
* ruby -v: 2.1.0-dev
* Backport: 2.0.0: UNKNOWN
----------------------------------------
So I wanted some real benefit of being lazy. I wrote a Leibniz formula:
```ruby
def leibniz(n)
(0..Float::INFINITY).lazy.with_index {|i, j| (-1 ** j) / (2*i+1).to_f }.take(n).reduce(:+)
end
```
But it doesn't work (well, it does, indeed. It just doesn't stop working). I got frustrated.
How about it? Don't you feel it nifty?
Of course I can wait for the release next to 2.0.0.
---Files--------------------------------
0001-enumerator.c-Enumerator-Lazy-with_index.patch (3.33 KB)
lazy-with-index-block-7877.patch (4.08 KB)
--
https://bugs.ruby-lang.org/
prev parent reply other threads:[~2019-08-09 8:07 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <redmine.issue-7877.20130218202740@ruby-lang.org>
2013-02-19 6:26 ` [ruby-dev:47045] [ruby-trunk - Feature #7877] E::Lazy#with_index needed nobu (Nobuyoshi Nakada)
2013-02-19 7:17 ` [ruby-dev:47046] " marcandre (Marc-Andre Lafortune)
2013-02-19 11:43 ` [ruby-dev:47047] " shyouhei (Shyouhei Urabe)
2013-02-19 16:30 ` [ruby-dev:47050] " marcandre (Marc-Andre Lafortune)
2013-02-20 6:01 ` [ruby-dev:47056] " shyouhei (Shyouhei Urabe)
2013-04-05 2:32 ` [ruby-dev:47225] " zzak (Zachary Scott)
2013-04-05 4:21 ` [ruby-dev:47226] " duerst (Martin Dürst)
2013-06-02 5:50 ` [ruby-dev:47390] " zzak (Zachary Scott)
2013-06-02 7:31 ` [ruby-dev:47392] [ruby-trunk - Bug #7877] E::Lazy#with_index should be lazy zzak (Zachary Scott)
2014-01-30 6:16 ` [ruby-dev:47932] " shibata.hiroshi
2014-07-16 14:03 ` [ruby-dev:48412] " nakilon
2016-08-08 1:59 ` [ruby-dev:49751] [Ruby trunk Bug#7877] " shyouhei
2016-10-11 7:18 ` [ruby-dev:49834] " shyouhei
2019-08-08 20:45 ` [ruby-dev:50829] [Ruby master " merch-redmine
2019-08-09 8:07 ` nobu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.ruby-lang.org/en/community/mailing-lists/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=redmine.journal-80515.20190809080718.783979356436323c@ruby-lang.org \
--to=ruby-dev@ruby-lang.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).