Skip Menu |

This queue is for tickets about the List-Compare CPAN distribution.

Report information
The Basics
Id: 95439
Status: resolved
Priority: 0/
Queue: List-Compare

People
Owner: jkeenan [...] cpan.org
Requestors: support1 [...] thetabiz.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.37
Fixed in: (no value)



Subject: Does not sort well first two items of the result list
First array: my @array1 = ( 11, 21, 7, 26, 17, 2, 22, 1, 18, 23, 16, 13, 27, 25, 6, 28, 3, 9, 12, 20, 14, 15, 8, 4, 24, 19, 10, 5); my @array2 = ( 26 ); my $lc = List::Compare->new( { lists => [ \@array1, \@array2 ], unsorted => 1 }); my @newarray = $lc->get_symdiff; print join(", ", @newarray); RESULT: First array was: 11, 21, 7, 26, 17, 2, 22, 1, 18, 23, 16, 13, 27, 25, 6, 28, 3, 9, 12, 20, 14, 15, 8, 4, 24, 19, 10, 5< array2 was = ( 26 ); RESULT not correctly sorted: 11, 21, 7, 2, 17, 22, 1, 18, 13, 16, 23, 27, 25, 6, 28, 3, 9, 12, 15, 14, 20, 8, 4, 24, 10, 19, 5 Instead of 17,2 after 7, it gives 2, 17 after 7, the rest is orderly sorted
On Wed May 07 07:26:16 2014, JLouisBiz wrote: Show quoted text
> First array: > my @array1 = ( 11, 21, 7, 26, 17, 2, 22, 1, 18, 23, 16, 13, 27, 25, 6, > 28, 3, 9, 12, 20, 14, 15, 8, 4, 24, 19, 10, 5); > > my @array2 = ( 26 ); > > my $lc = List::Compare->new( { > lists => [ \@array1, \@array2 ], > unsorted => 1 > }); >
Please note that you explicitly passed "unsorted => 1" to the constructor. Hence, there should be no expectation about the sorting order of any results. I do not see a bug here. Show quoted text
> my @newarray = $lc->get_symdiff; > > print join(", ", @newarray); > > RESULT: > First array was: > 11, 21, 7, 26, 17, 2, 22, 1, 18, 23, 16, 13, 27, 25, 6, 28, 3, 9, 12, > 20, 14, 15, 8, 4, 24, 19, 10, 5< > > array2 was = ( 26 ); > > RESULT not correctly sorted: > 11, 21, 7, 2, 17, 22, 1, 18, 13, 16, 23, 27, 25, 6, 28, 3, 9, 12, 15, > 14, 20, 8, 4, 24, 10, 19, 5 > > Instead of 17,2 after 7, it gives 2, 17 after 7, the rest is orderly > sorted
Thank you very much. Jim Keenan
From: support1 [...] thetabiz.com
I was under impression, and I still think that unsorted option shall be there, because not the sort was needed, but rather the following result on bottom: Show quoted text
> First array: > my @array1 = ( 11, 21, 7, 26, 17, 2, 22 ); > my @array2 = ( 26 );
Show quoted text
> my $lc = List::Compare->new( { > lists => [ \@array1, \@array2 ], > unsorted => 1 > }); > > my @newarray = $lc->get_symdiff;
RESULT SHALL BE: 11, 21, 7, 17, 2, 22 BUT NOT LIKE IT IS NOW: 11, 21, 7, 2, 17, 22 If the order by this module is attempted to be preserved, which is obvious, with unsorted option, why not make it right, without switching the first 2 list items after the removed list item.