From: Dave Thomas Date: 2002-02-27T08:17:49+09:00 Subject: Re: fiddly little array manipulation question Phil Mitchell writes: > Is there a nicer way to take the intersection of an array of arrays, other > than: > > intersection = arrOfArrays[0] > for i in 1...arrOfArrays.length > intersection &= arrOfArrays[i] > end You could use #inject under 1.7 Otherwise, I personally tend not to like indexing, so I might write intersection, *array_copy = arr_of_arrays array_copy.each {|arr| intersection &= arr } But it depends on the size of arr_of_arrays: I wouldn't to this if it was likely to be big. Cheers Dave