From: rpmohn@... (Ross Mohn) Date: 2000-12-03T12:40:01+09:00 Subject: [ruby-talk:6757] Re: Array Intersect (&) question hal9000@hypermetrics.com (Hal E. Fulton) wrote in <001901c05cc1$ee8c75c0$01f9fea9@austin.rr.com>: >> 3) Finally, I believe there is a logic bug in the current intersect >> functionality. I actually would expect that two arrays, both with the >> same dup elements would yield that dup in the intersection: >> >> a2 = %w# 1 1 y # -> ["1", "1", "y"] >> a3 = %w# 1 y 1 z # -> ["1", "y", "1", "z"] >> a2 & a3 -> ["1", "y"] >> >> Whereas I believe the true intersection of a2 & a3 should be >> ["1", "1", "y"] . Opinions? >> > >Hmm, I can't agree with you on this one. The very term "intersect" >suggests to me a mathematical set; a set intersection (in math) >never results in duplicates because sets can't have duplicates. Is it valid (in math) to be intersecting sets that contain duplicates? We may be talking in circles here. To me, if you are intersecting things that contain duplicates (and therefore already violate the mathematical set rules) then you should preserve that during the intersection. -RPM -- Ross Mohn rpmohn@panix.com