From: matz@... (Yukihiro Matsumoto) Date: 2000-12-04T00:15:44+09:00 Subject: [ruby-talk:6767] Re: Array Intersect (&) question Hi, In message "[ruby-talk:6763] Re: Array Intersect (&) question" on 00/12/03, peter.wood@worldonline.dk writes: |I agree with Ross. Presumably, if you are intersecting "pseudo-sets" |with duplicates, you WANT the duplicates. Ruby should not second |guess you. If you don't want the duplicates, you can easily remove |them, but its trickier to go the other way. Hmm, interesting. |(How do other languages do it? Common Lisp preserves the duplicates, |in the way Ross wants: | |(intersection '(1 1 y) '(1 y 1 z)) |=> (1 1 y)) I feel neither >(intersection '(1 1 2) '(1 2 2)) (2 1 1) nor >(intersection '(1 1 2) '(1 2 2)) (2 2 1) is natural intersection. Both make me suspect easy implementation. Probably proper intersection is '(1 2) for this case. matz.