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 2333419E005C for ; Fri, 18 Dec 2015 12:55:53 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id 32E65B5D88C for ; Fri, 18 Dec 2015 13:28:00 +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 98EAB18CC7B8 for ; Fri, 18 Dec 2015 13:28:00 +0900 (JST) Received: from [221.186.184.76] (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id BDAA6120781; Fri, 18 Dec 2015 13:27:56 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from mail-io0-f170.google.com (mail-io0-f170.google.com [209.85.223.170]) by neon.ruby-lang.org (Postfix) with ESMTPS id 31B6A120755 for ; Fri, 18 Dec 2015 13:27:50 +0900 (JST) Received: by mail-io0-f170.google.com with SMTP id q126so77894174iof.2 for ; Thu, 17 Dec 2015 20:27:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:message-id:subject:mime-version:content-type; bh=WmQ15nl6B/QNW5zcF8xeCtQh+cMyP4fPMhU9nMfhrps=; b=EuKypzk0OYk1WSmvW47olEue/v5epw8hkPtl+R+tamg60Upq/4RgpdrcjkYZjd2MLL bw3/iv22CEKh3qnlWjg2G99M3xjzn5YZACZUjrJGSiqeKMiAoXR4XkmOFn8fVnCfZAaY o/jx09wH0BETXrOz4eHr/+mQOQLT6SLYjb7fGx96iwI4ZXSCP94LRrkGRQcb2vt+KbHo +3JTLOlI4xwaNOwAr3iRgQSYX/yluNfsTDPJjKwsjBnI1oVVG4sSD2+luCcC6LVbXR6O lWDfnDIPisRs6X31NLr7PN6GWAvYfnU4X916PwjkFqdyvyqCSxIsz4Kj4Ym2X7BLBuoJ 0tWg== X-Received: by 10.107.133.211 with SMTP id p80mr2356295ioi.16.1450412868970; Thu, 17 Dec 2015 20:27:48 -0800 (PST) Received: from Josephe-Jones (75-166-130-47.hlrn.qwest.net. [75.166.130.47]) by smtp.gmail.com with ESMTPSA id d9sm1989906igx.5.2015.12.17.20.27.47 for (version=TLSv1/SSLv3 cipher=OTHER); Thu, 17 Dec 2015 20:27:48 -0800 (PST) Date: Thu, 17 Dec 2015 21:27:47 -0700 From: Joseph Jones To: Ruby developers Cc: Message-ID: <74A79E45-A2C2-41B7-81E1-8A73F42EF639@gmail.com> X-Mailer: BoxerFree 6.0.4 (321) X-Boxer-Generated: true X-Boxer-IsLike: true MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="56738b43_1df029d3_16c" X-ML-Name: ruby-core X-Mail-Count: 72353 Subject: [ruby-core:72353] [Ruby trunk - Feature #11797] [Open] `Enumerator#with_object` with multiple objects 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" --56738b43_1df029d3_16c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Joseph Jones liked your message with Boxer. On December 9, 2015 at 09:15:= 54 MST, sawadatsuyoshi=40gmail.com wrote:Issue =2311797 has been reported= by Tsuyoshi Sawada.----------------------------------------=46eature =23= 11797: =60Enumerator=23with=5Fobject=60 with multiple objectshttps://bugs= .ruby-lang.org/issues/11797* Author: Tsuyoshi Sawada* Status: Open* Prior= ity: Normal* Assignee: ----------------------------------------Sometimes,= when working with =60Enumerator=23with=5Fobject=60, I want to keep some = additional temporary objects besides the one to return. A use case is as = follows (I got this from this StackOverflow question: http://stackoverflo= w.com/questions/3418123). Suppose I have an enumerator created from an ar= ray: e =3D =5B=22a=22, =22b=22, =22c=22, =22c=22, =22a=22, =22c=22=5D.to=5F= enumand want to get an array of its repeated elements in the order they a= re repeated (i.e., appears for the second time): =23 =3D> =5B=22c=22, =22= a=22=5DI can do it using =60Enumerator=23with=5Fobject=60 like this: e.to= =5Fenum.with=5Fobject(=5B=7B=7D, =5B=5D=5D)=7B=7Cc, (h, a)=7C h=5Bc=5D =3F= a.push(c) : h.store(c, true)=7D.last.uniqHere, I am getting the array re= ferred to as =60a=60 in the block, but besides that, I am using a tempora= l hash =60h=60. I thought it would be nice if =60Enumerator=23with=5Fobje= ct=60 accepts one or more objects, pass them individually as block argume= nts, and returns only the last argument so that I can do this: e.to=5Fenu= m.with=5Fobject(=7B=7D, =5B=5D)=7B=7Cc, h, a=7C h=5Bc=5D =3F a.push(c) : = h.store(c, true)=7D.uniq-- https://bugs.ruby-lang.org/ --56738b43_1df029d3_16c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Joseph Jones liked your message with Boxer.


= On December 9, 2015 at 09:15:54 MST, sawadatsuyoshi=40gmail.com wrote:
Issue =2311797 has been = reported by Tsuyoshi Sawada.

---------------------------------= -------
=46eature =2311797: =60Enumerator=23with=5Fobject=60 with mu= ltiple objects
https://bugs.ruby-lang.org/issues/11797

* = Author: Tsuyoshi Sawada
* Status: Open
* Priority: Normal
= * Assignee:
----------------------------------------
Sometimes= , when working with =60Enumerator=23with=5Fobject=60, I want to keep some= additional temporary objects besides the one to return. A use case is as= follows (I got this from this StackOverflow question: http://stackoverfl= ow.com/questions/3418123). Suppose I have an enumerator created from an a= rray:

e =3D =5B=22a=22, =22b=22, =22c=22, =22c=22, =22a=22= , =22c=22=5D.to=5Fenum

and want to get an array of its repeate= d elements in the order they are repeated (i.e., appears for the second t= ime):

=23 =3D> =5B=22c=22, =22a=22=5D

I can do = it using =60Enumerator=23with=5Fobject=60 like this:

e.to=5F= enum.with=5Fobject(=5B=7B=7D, =5B=5D=5D)=7B=7Cc, (h, a)=7C h=5Bc=5D =3F a= .push(c) : h.store(c, true)=7D.last.uniq

Here, I am getting th= e array referred to as =60a=60 in the block, but besides that, I am using= a temporal hash =60h=60. I thought it would be nice if =60Enumerator=23w= ith=5Fobject=60 accepts one or more objects, pass them individually as bl= ock arguments, and returns only the last argument so that I can do this:<= br />
e.to=5Fenum.with=5Fobject(=7B=7D, =5B=5D)=7B=7Cc, h, a=7C = h=5Bc=5D =3F a.push(c) : h.store(c, true)=7D.uniq



=
--
https://bugs.ruby-lang.org/
= --56738b43_1df029d3_16c--