[#18651] Enumerable#zip — matz@... (Yukihiro Matsumoto)

まつもと ゆきひろです

77 messages 2002/11/05
[#18659] Re: Enumerable#zip — Shin-ichiro HARA <sinara@...> 2002/11/06

原です。

[#18669] Re: Enumerable#zip — matz@... (Yukihiro Matsumoto) 2002/11/06

まつもと ゆきひろです

[#18675] Re: Enumerable#zip — Shin-ichiro HARA <sinara@...> 2002/11/07

原です。

[#18684] Re: Enumerable#zip — matz@... (Yukihiro Matsumoto) 2002/11/07

まつもと ゆきひろです

[#18690] Re: Enumerable#zip — Shin-ichiro HARA <sinara@...> 2002/11/08

原です。

[#18728] Re: Enumerable#zip — Daisuke Aoki <dai@...> 2002/11/09

青木@横浜です。基本的にROM な人間なんですがなんとなく書いてみました。

[#18774] Re: Enumerable#zip — Daisuke Aoki <dai@...> 2002/11/13

青木@横浜です。

[#18799] Re: Enumerable#zip — Shin-ichiro HARA <sinara@...> 2002/11/15

原です。

[#18802] Re: Enumerable#zip — Tanaka Akira <akr@...17n.org> 2002/11/15

In article <5.1.1.8.2.20021115145423.03541008@blade.nagaokaut.ac.jp>,

[#18803] Re: Enumerable#zip — matz@... (Yukihiro Matsumoto) 2002/11/15

まつもと ゆきひろです

[#18806] Re: Enumerable#zip — Tanaka Akira <akr@...17n.org> 2002/11/15

In article <1037348006.479453.32695.nullmailer@picachu.netlab.jp>,

[#18808] Re: Enumerable#zip — matz@... (Yukihiro Matsumoto) 2002/11/15

まつもと ゆきひろです

[#18823] Re: Enumerable#zip — Shugo Maeda <shugo@...> 2002/11/18

前田です。

[#18833] Re: Enumerable#zip — Tanaka Akira <akr@...17n.org> 2002/11/18

In article <8765uv4fu7.wl@studly.priv.netlab.jp>,

[#18835] Re: Enumerable#zip — Shugo Maeda <shugo@...> 2002/11/18

前田です。

[#18845] Re: Enumerable#zip — Tanaka Akira <akr@...17n.org> 2002/11/19

In article <874raf6xuc.wl@studly.priv.netlab.jp>,

[#18870] Re: Enumerable#zip — Shugo Maeda <shugo@...> 2002/11/21

前田です。

[#18873] Re: Enumerable#zip — Tanaka Akira <akr@...17n.org> 2002/11/21

In article <87fztv5zir.wl@studly.priv.netlab.jp>,

[#18692] Re: Enumerable#zip — Tanaka Akira <akr@...17n.org> 2002/11/08

In article <4.3.2-J.20021108124934.033a2eb0@blade.nagaokaut.ac.jp>,

[#18696] Re: Enumerable#zip — Shin-ichiro HARA <sinara@...> 2002/11/08

原です。

[#18713] Re: Enumerable#zip — matz@... (Yukihiro Matsumoto) 2002/11/09

まつもと ゆきひろです

[#18719] Re: Enumerable#zip — Tanaka Akira <akr@...17n.org> 2002/11/09

In article <1036742681.769607.13070.nullmailer@picachu.netlab.jp>,

[#18721] Re: Enumerable#zip — matz@... (Yukihiro Matsumoto) 2002/11/09

まつもと ゆきひろです

[#18723] Re: Enumerable#zip — Tanaka Akira <akr@...17n.org> 2002/11/09

In article <1036847474.074389.7942.nullmailer@picachu.netlab.jp>,

[#18735] Re: Enumerable#zip — Shin-ichiro HARA <sinara@...> 2002/11/11

原です。

[#18746] Re: Enumerable#zip — matz@... (Yukihiro Matsumoto) 2002/11/11

まつもと ゆきひろです

[#18749] Re: Enumerable#zip — Shin-ichiro HARA <sinara@...> 2002/11/12

原です。

[#18766] Re: Enumerable#zip — matz@... (Yukihiro Matsumoto) 2002/11/13

まつもと ゆきひろです

[#18800] Re: Enumerable#zip — Shin-ichiro HARA <sinara@...> 2002/11/15

原です。

[#18801] Re: Enumerable#zip — matz@... (Yukihiro Matsumoto) 2002/11/15

まつもと ゆきひろです

[#18804] Re: Enumerable#zip — Shin-ichiro HARA <sinara@...> 2002/11/15

原です。

[#18805] Re: Enumerable#zip — matz@... (Yukihiro Matsumoto) 2002/11/15

まつもと ゆきひろです

[#18754] Different caller(0) in trace_func when NameError from toplevel between 1.6 and 1.7 — "NAKAMURA, Hiroshi" <nahi@...>

なひです。

27 messages 2002/11/12
[#18755] Re: Different caller(0) in trace_func when NameError from toplevel between 1.6 and 1.7 — nobu.nakada@... 2002/11/12

なかだです。

[#18776] Re: Different caller(0) in trace_func when NameError from toplevel between 1.6 and 1.7 — "NAKAMURA, Hiroshi" <nakahiro@...> 2002/11/14

なひです。

[#18777] Re: Different caller(0) in trace_func when NameError from toplevel between 1.6 and 1.7 — "NAKAMURA, Hiroshi" <nakahiro@...> 2002/11/14

なひです。ひええすいません、タブが落ちちゃった。

[#18789] Re: Different caller(0) in trace_func when NameError from toplevel between 1.6 and 1.7 — "NAKAMURA, Hiroshi" <nahi@...> 2002/11/14

なひです。

[#18795] Re: Different caller(0) in trace_func when NameError from toplevel between 1.6 and 1.7 — nobu.nakada@... 2002/11/15

なかだです。

[#18820] deprecated method( Re: Different caller(0) in trace_func when NameError from toplevel between 1.6 and 1.7) — nobu.nakada@... 2002/11/18

なかだです。

[#18821] Re: deprecated method( Re: Different caller(0) in trace_func when NameError from toplevel between 1.6 and 1.7) — matz@... (Yukihiro Matsumoto) 2002/11/18

まつもと ゆきひろです

[#18825] Re: deprecated method( Re: Different caller(0) in trace_func when NameError from toplevel between 1.6 and 1.7) — nobu.nakada@... 2002/11/18

なかだです。

[#18861] class variables — matz@... (Yukihiro Matsumoto)

まつもと ゆきひろです

31 messages 2002/11/20
[#18913] Re: class variables — "K.Kosako" <kosako@...> 2002/11/22

Yukihiro Matsumotoさんの

[#18895] [patch] install bat file on Windows — "U.Nakamura" <usa@...>

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

14 messages 2002/11/22
[#18900] Re: [patch] install bat file on Windows — "Akinori MUSHA" <knu@...> 2002/11/22

At Fri, 22 Nov 2002 11:09:19 +0900,

[#18903] Re: [patch] install bat file on Windows — "U.Nakamura" <usa@...> 2002/11/22

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

[#18966] [ONIGURUMA] \S doesn't match multibyte char (Re: [ruby-list:36618] Re: 全角文字に挟まれた半角スペースを削除するには?) — nobu.nakada@...

なかだです。

13 messages 2002/11/28

[ruby-dev:18713] Re: Enumerable#zip

From: matz@... (Yukihiro Matsumoto)
Date: 2002-11-09 01:38:48 UTC
List: ruby-dev #18713
まつもと ゆきひろです

In message "[ruby-dev:18696] Re: Enumerable#zip"
    on 02/11/08, Shin-ichiro HARA <sinara@blade.nagaokaut.ac.jp> writes:

|In [ruby-dev:18692] Re: Enumerable#zip
|   Tanaka Akira writes:
|
| >ふと思ったんですが、Enumerable.zip(a, b, c, ...) はどうでしょう?
| >同じかなぁ。
|
|相変わらず不揃いなデータへの対応の問題は残りますが、それもあり得ますよ
|ね。でもそうすると、a, b, c, ... に Array でなくて、Enumerable を入れ
|たくなりません?そしてそれなら、Enumerable.map(a, b, c, ...)  という名
|前でいいし、同様に Enumerable.each(a, b, c, ...) などのイテレータも考
|えられる。だだし、この「平行 each 系」というのは、今までの Ruby の雰囲
|気から逸脱したところがあるのですが。

そうですね。threadやcontinuationを使えばEnumerableでも並行
eachができますが(添付)。

| >> 後者が好きではないのは、「Array の各要素が Array であることを仮定する
| >> メソッドを Array に作り込むのが気持ち悪い」ということですかね。つまり、
| >> そんなふうに「タイプ X 上の Array」に対する Array のメソッドを作って行っ
| >> たらきりがない、ということでしょうか?
| >
| >まぁ、すでに assoc なんてのもありますけどね。
|
|そうですね。だから、配列の配列に限って、若干サービスを拡大してもいいん
|じゃないかと思った訳です。

どっちかっていうと見かけが悪いってところじゃないでしょうか。

--- 添付: generator.rb
class Generator
  def initialize(method, *args)
    @cont_l = nil
    method.call(*args) {|v|
      callcc {|c|
	@cont_i = c
	@value = v
	return unless @cont_l
	@cont_l.call
      }
    }
    @cont_i = nil
    @cont_l.call
  end
  def next
    unless @cont_i
      raise "no more element"
    end
    v = @value
    callcc{|cc|
      @cont_l = cc
      @cont_i.call
    }
    v
  end
  def more?
    if @cont_i then true else false end
  end
end

class Object
  def generator(method, *args)
    Generator.new(self.method(method), *args)
  end
end

if $0 == __FILE__
  def zip(*args)
    generators = args.collect{|x| x.generator(:each)}
    ary = []
    while generators.any?{|x| x.more?}
      ary.push(generators.collect{|x| x.next rescue nil})
    end
    ary
  end

  a = 1..10
  b = "a".."z"
  for x,y in zip(a,b)
    p [x,y]
  end
end

In This Thread