From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: poffice@blade.nagaokaut.ac.jp Delivered-To: poffice@blade.nagaokaut.ac.jp Received: from kankan.nagaokaut.ac.jp (kankan.nagaokaut.ac.jp [133.44.2.24]) by blade.nagaokaut.ac.jp (Postfix) with ESMTP id 9BCA617D5F7E for ; Mon, 3 Mar 2014 06:23:45 +0900 (JST) Received: from funfun.nagaokaut.ac.jp (funfun.nagaokaut.ac.jp [133.44.2.201]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id A61A0B5D858 for ; Mon, 3 Mar 2014 06:17:56 +0900 (JST) Received: from funfun.nagaokaut.ac.jp (localhost.nagaokaut.ac.jp [127.0.0.1]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id 4AFCC97A832 for ; Mon, 3 Mar 2014 06:17:57 +0900 (JST) X-Virus-Scanned: amavisd-new at nagaokaut.ac.jp Authentication-Results: funfun.nagaokaut.ac.jp (amavisd-new); dkim=fail (1024-bit key) reason="fail (message has been altered)" header.d=sendgrid.me Received: from funfun.nagaokaut.ac.jp ([127.0.0.1]) by funfun.nagaokaut.ac.jp (funfun.nagaokaut.ac.jp [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id h-bgLx5dF1Wn for ; Mon, 3 Mar 2014 06:17:57 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id F266597A820 for ; Mon, 3 Mar 2014 06:17:56 +0900 (JST) Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by voscc.nagaokaut.ac.jp (Postfix) with ESMTP id 55AB0952408 for ; Mon, 3 Mar 2014 06:17:56 +0900 (JST) Received: from [221.186.184.76] (unknown [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id A414F12056B; Mon, 3 Mar 2014 06:17:38 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from o10.shared.sendgrid.net (o10.shared.sendgrid.net [173.193.132.135]) by neon.ruby-lang.org (Postfix) with SMTP id EC74912049E for ; Mon, 3 Mar 2014 06:17:35 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.me; h=from:to:references:subject:mime-version:content-type:content-transfer-encoding:list-id; s=smtpapi; bh=oj6DdCN1xilqYYgr8LHdcTAa7yE=; b=H35gAV1PT/Wvw0K+DZ TSNA8LGuC6+vn4wevIDvSSrT+Bw7po9UYkf5TF3FHbqCRhyGDzmBvDtmTbHdErAA YKgYdSSCdzsfhis9QddCutWWJXroE7XeZTkuE9rLOkt+I/1yyDdhYzMBjsDFEeYw ecg2BCR/dcEPcCmGwaCvX8wlY= Received: by mf178.sendgrid.net with SMTP id mf178.18553.53139FEE3 Sun, 02 Mar 2014 21:17:34 +0000 (UTC) Received: from herokuapp.com (ec2-54-227-201-91.compute-1.amazonaws.com [54.227.201.91]) by ismtpd-023 (SG) with ESMTP id 14484a8b9e6.5321.6a5c95 for ; Sun, 02 Mar 2014 21:17:34 +0000 (GMT) Date: Sun, 02 Mar 2014 21:17:33 +0000 From: ruby-core@marc-andre.ca To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Redmine-MailingListIntegration-Message-Ids: 35058 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 9587 X-Redmine-Issue-Author: sawa X-Redmine-Sender: marcandre X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: OOF Auto-Submitted: auto-generated X-SG-EID: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS7tSPSMkmurzATMqabBzwU/q0OFzO6uly6WXRpkDk3VolUT3HcwE8KeH5JixbF0Yph5S0SdY8XVgeR+32Hc28R/vYp1WtlCBxvkwTeaN17DE8yYWokHUa2Wk3rRN/2qy14= X-ML-Name: ruby-core X-Mail-Count: 61234 Subject: [ruby-core:61234] [ruby-trunk - Feature #9587] Integer#times with optional starting value X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #9587 has been updated by Marc-Andre Lafortune. How exactly would it be easier than `1.upto(6)`? ---------------------------------------- Feature #9587: Integer#times with optional starting value https://bugs.ruby-lang.org/issues/9587#change-45580 * Author: Tsuyoshi Sawada * Status: Open * Priority: Normal * Assignee: * Category: * Target version: ---------------------------------------- Just like `Enumerator#with_index` takes an optional argument that specifies the initial value of the index, I would like to request that `Integer#times` take an optional argument that specifies the initial value. The usefulness of it is similar to that of `with_index` taking an argument. We sometimes want to repeat tasks a given number of times, and want to use an index not necessarily starting from `0`. 6.times(1){|i| puts "Chapter #{i}"} should give Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 with the return value `6`. We can do it with `1.upto(6)`, or with `#{i + 1}` within the block, but giving the initial value to `times` is much easier. -- http://bugs.ruby-lang.org/