[#39804] CGIでのリダイレクションの書き方 — Yoichiro Takehora <yoichiro@...>
こんにちは、竹洞です。
7 messages
2004/07/02
[#39811] keyword-argument-like argument passing via Hash — NISHIMATSU Takeshi <t-nissie@...>
西松と申します.
4 messages
2004/07/02
[#39814] Socket:IPヘッダの編集方法 — takeshi honda <moecho21@...>
本田と申します。
6 messages
2004/07/02
[#39819] [ANN] Ruby-GetText-Package-0.6.0 — Masao Mutoh <mutoh@...>
むとうです。
4 messages
2004/07/04
[#39822] (要素がString, Fixnum 以外の)配列の集合演算 — Hiroshi Takagi <gollum@...>
高木といいます、よろしく。
11 messages
2004/07/05
[#39823] Re: (要素がString, Fixnum 以外の)配列の集合演算
— 卜部昌平 <s-urabe@...>
2004/07/05
mput です。
[#39824] Re: (要素がString, Fixnum 以外の)配列の集合演算
— Hiroshi Takagi <gollum@...>
2004/07/05
高木です。
[#39826] Re: (要素がString, Fixnum 以外の)配列の集合演算
— nobu.nakada@...
2004/07/06
なかだです。
[#39856] 直接関係のない配列の有無が、ある配列の値に影響する不具合 — "Hisashi Yahata" <yahatah@...>
5 messages
2004/07/17
[#39863] forループの速度 — Masahiro Sato <msato@...>
15 messages
2004/07/20
[#39868] イテレータとfor文 — OOTANI TAKASHI <otn@...5.so-net.ne.jp>
大谷と申します。
31 messages
2004/07/20
[#39870] Re: イテレータとfor文
— Nowake <nowake@...>
2004/07/20
[#39886] Re: イテレータとfor文
— Tietew <tietew-ml-ruby-list@...>
2004/07/21
[#39891] Re: イテレータとfor文
— OOTANI TAKASHI <otn@...5.so-net.ne.jp>
2004/07/21
大谷です。
[#39910] Re: イテレータとfor文
— Atoh <atoh@...7.jp>
2004/07/23
あとうです。
[#39911] Re: イテレータとfor文
— OOTANI TAKASHI <otn@...5.so-net.ne.jp>
2004/07/23
大谷です。
[#39889] dRuby: 急に遅くなる — ちば けいすけ <chowder@...>
ちばです。
7 messages
2004/07/21
[#39908] htreeの高速化 — MoonWolf <moonwolf@...>
MoonWolfです。
6 messages
2004/07/23
[ruby-list:39826] Re: (要素がString, Fixnum 以外の)配列の集合演算
From:
nobu.nakada@...
Date:
2004-07-06 00:17:04 UTC
List:
ruby-list #39826
なかだです。
At Tue, 6 Jul 2004 00:32:53 +0900,
Hiroshi Takagi wrote in [ruby-list:39824]:
> > def eql?(other)
> > @attr1.eql?(other.attr1) && @attr2.eql?(other.attr2)
> > end
> > def hash
> > @attr1.hash + @attr2.hash
> > end
>
> def hash の方は、いろいろな定義ができると思いますが、
> def eql?(other) の方は、いつもこういうパターンになりますね。
>
> うう、この二つがMix in できるような方法はないものか...
こんな感じでどうでしょうか。
module Hash::ReadyMade
def eql?(other)
self.class == other.class and
(sv = instance_variables).size == (ov = other.instance_variables).size and
(v = nil; oh = {}; ov.each {|v| oh[v] = true}; sv).all? do |v|
ov.include?(v) and
instance_variable_get(v).eql?(other.instance_variable_get(v))
end
end
def hash
instance_variables.inject(self.class.hash) {|h, v| h ^ instance_variable_get(v).hash}
end
end
--
--- 僕の前にBugはない。
--- 僕の後ろにBugはできる。
中田 伸悦