From: Bill Kelly Date: 2006-04-20T01:49:33+09:00 Subject: Re: Is there an "in" operator in ruby ? From: "Jake McArthur" > > If Array was extended with some set theory, things like this would be > possible: > > @test.intersect([1..10]).each { |item| puts item } >> x = [*1..5] => [1, 2, 3, 4, 5] >> y = [*3..7] => [3, 4, 5, 6, 7] >> x & y => [3, 4, 5] >> x | y => [1, 2, 3, 4, 5, 6, 7] >> x - y => [1, 2] >> y - x => [6, 7] Regards, Bill