From: "Brian Schröder" Date: 2005-10-16T18:36:31+09:00 Subject: Re: Set.new vs Set[] On 15/10/05, Daniel Berger wrote: > Hi all, > > Ruby 1.8.3 > > irb(main):001:0> require "set" > => true > > irb(main):002:0> a = [0,1,2,3,4,5,2,3] > => [0, 1, 2, 3, 4, 5, 2, 3] > > irb(main):003:0> set1 = Set.new(a) > => # > > irb(main):004:0> set2 = Set[a] > => # > > Shouldn't the set returned by Set[] also be only the unique values? > > Regards, > > Dan > > > bschroed@black:~$ irb -r set irb(main):001:0> a = [0,1,2,3,4,5,2,3] => [0, 1, 2, 3, 4, 5, 2, 3] irb(main):002:0> Set.new(a) => # irb(main):003:0> Set[a] => # irb(main):004:0> Set[*a] => # The third line is a set containing one array, the fourth line is a set with the elements of an array. hth, Brian -- http://ruby.brian-schroeder.de/ Stringed instrument chords: http://chordlist.brian-schroeder.de/