From: rpmohn@... (Ross Mohn) Date: 2000-12-04T20:40:02+09:00 Subject: [ruby-talk:6800] Re: Array Intersect (&) question matz@zetabits.com (Yukihiro Matsumoto) wrote in : >|(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. Yes, (1 2) is definitely the proper intersection in this case. Your intersection would not contain duplicates unless BOTH sets had the duplicate: (intersection '(1 1 2) '(1 2 1 2)) (1 1 2) -RPM -- Ross Mohn rpmohn@panix.com