From: Gennady Bystritsky Date: 2009-08-04T14:23:42+09:00 Subject: Re: The Easiest way to check if one array is a subset of another > -----Original Message----- > From: superdisconnect@hotmail.com [mailto:superdisconnect@hotmail.com] > Sent: Monday, August 03, 2009 10:13 PM > To: ruby-talk ML > Subject: The Easiest way to check if one array is a subset of another > > I want to find the easiest way if one array is a subset of another > > for example > > A b > [1,2,4,5,6,7,9] [1,3,9] =>true > > A b > [1,2,4,5,6,7,9] [1,3,8] =>false > -- > Posted via http://www.ruby-forum.com/. If I understand correctly what you really want, the first example should produce false, as array "a" does not have 3. Assuming that you meant [1,2,3,4,5,6,7,9] I think the following will work for you: (a & b) == b Gennady.