Project

General

Profile

Actions

Bug #1028

closed

Array#zip cannot accept enumerables as arguments.

Added by usa (Usaku NAKAMURA) almost 16 years ago. Updated over 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
Backport:
[ruby-dev:37797]

Description

=begin
こんにちは、なかむら(う)です。

In message "[ruby-cvs:28896] Ruby:r21678 (trunk): * array.c (take_items), enum.c (enum_zip): tries to convert to"
on Jan.20,2009 06:47:50, wrote:

nobu 2009-01-20 06:47:48 +0900 (Tue, 20 Jan 2009)

New Revision: 21678

http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=21678

Log:
* array.c (take_items), enum.c (enum_zip): tries to convert to
array first. [ruby-core:21442]

たぶん、arrayへの変換を試し、ダメならeachで回す、というのが意
図だろうと思うのですが、Enumerable#zipは大丈夫ですがArray#zip
がそうなっていません。

Index: array.c

--- array.c (revision 21699)
+++ array.c (working copy)
@@ -2209,7 +2209,7 @@ take_i(VALUE val, VALUE *args, int argc,
static VALUE
take_items(VALUE obj, long n)
{

  • VALUE result = to_ary(obj);
  • VALUE result = rb_check_array_type(obj);
    VALUE args[2];

    if (!NIL_P(result)) return rb_ary_subseq(result, 0, n);

    それでは。
    --
    U.Nakamura
    =end

Actions #1

Updated by usa (Usaku NAKAMURA) almost 16 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
Applied in changeset r21713.
=end

Actions

Also available in: Atom PDF

Like0
Like0