From: George George Date: 2009-04-03T17:17:05+09:00 Subject: Re: An array problem Robert Klemme wrote: > I don't see how the order in a could not be preserved. Please check > again oder provide full code. Here is the code #original list @list_of_names #mcl.total_clusters provides a count for the number of clusters #or arrays available(a.k.a, my b and c in the previous #descriptions) #an iterator that counts the number of arrays available(subsets #of @cluster_members mcl.total_clusters.times do |i| cluster_members = mcl.cluster_members_for(i) @list_of_names.each do |el| case when cluster_members.include?(el) puts "#{el} - #{i}" end end end Given: @list_of_names = [10Atig18,10Atig8,10Atig7,10Atig3,10Btig15,10Btig11,10Btig1], and cluster b=[10Atig8,10Atig3,10Btig1] while the rest of the members belonged to cluster c produce a report such that 10Atig18 -c 10Atig8 -b 10Atig7 -c 10Atig3 -b 10Btig15 -c 10Btig11 -c 10Btig1 -b The implementation above produces this, 10Atig8 -b 10Atig3 -b 10Btig1 -b 10Atig18 -c 10Atig7 -c 10Btig15 -c 10Btig11 -c which is not what is required. -- Posted via http://www.ruby-forum.com/.