ruby-reference-manual:807
From: redmine@r...
Date: Tue, 3 Jun 2008 22:13:32 +0900
Subject: [ruby-reference-manual:807] [ReferenceManualRenewalProject - Bug #33] (Open) Enumerable#injectの説明
Issue #33 has been reported by Ken DATE. ---------------------------------------- Bug #33: Enumerable#injectの説明 http://redmine.ruby-lang.org/issues/show/33 Author: Ken DATE Status: Open Priority: Normal Assigned to: Category: doc Target version: reporter: rock ruby_version: 1.8 Enumerable#inject の説明の「合計を計算する」の例が p [1, 2,3, 4, 5].inject(0) {|result, item| result + item } となっていますが,無駄な計算をさせないため inject の初期値を省略すべきと思います。 逆に初期値の必要な例として, p %w(u b i).inject("text"){|result, tag| "<#{tag}>#{result}</#{tag}>"} みたいのを挙げるのはいかがでしょうか。 ---------------------------------------- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://redmine.ruby-lang.org/my/account