[sorted] Am I missing something?

From: Marc van Dongen <dongen_at_cs.ucc.ie>
Date: Fri 08 Nov 2002 02:52:07 PM GMT
Message-ID: <20021108145207.GA2338@cs.ucc.ie>
Hi there,


Perhaps I am missing something but I think this is a bug.
Unless I am wrong, the predicates test1 and test2 should
output the same.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
test1 :-
  length( VEC, 8 ),                        % same
  VEC :: 0..3,                             % same
  OS = [O0,O1,O2,O3],
  occurrences( 0, VEC, O0 ),               % same
  occurrences( 1, VEC, O1 ),               % same
  occurrences( 2, VEC, O2 ),               % same
  occurrences( 3, VEC, O3 ),               % same
  sorted( OS, SS, _ ),
  VEC = [2,2,2,2,3,3,3,3],                 % same
  printf( "%q %q%n",[OS,SS] ).

test2 :-
  length( VEC, 8 ),                        % same
  VEC :: 0..3,                             % same
  occurrences( 0, VEC, O0 ),               % same
  occurrences( 1, VEC, O1 ),               % same
  occurrences( 2, VEC, O2 ),               % same
  occurrences( 3, VEC, O3 ),               % same
  sorted( [O0,O1,02,03], SS, _ ),
  VEC = [2,2,2,2,3,3,3,3],                 % same
  printf( "%q %q%n",[[O0,O1,O2,O3],SS] ).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

The only difference between the two predicates is
that test1 uses the list OS = [O0,O1,O2,O3], whereas
test2 uses [O0,O1,O2,O3] as the arguments of
sorted and printf.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Using test1 results in:
[eclipse 1]: test1.
[0, 0, 4, 4] [0, 0, 4, 4]



Delayed goals:
        alldifferent([_1480{[1, 2]}, _1495{[1, 2]}], 1)
        _1510{[3, 4]} #\= _1525{[3, 4]}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Using test2 results in:
[eclipse 1]: test2.
[0, 0, 4, 4] [0, 0, 2, 3]



Delayed goals:
        alldifferent([_1423{[1, 2]}, _1438{[1, 2]}], 1)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Am I missing something?

Regards,


Marc van Dongen
-- 
M.R.C. van Dongen | CS Dept University College Cork    |        ()
 dongen@cs.ucc.ie | Cork Constraint Computation Centre |        /\
+353(0)21 4903578 | Western Road                       |   ASCII ribbon
                  | Cork, Ireland                      | against html mail
Received on Fri Nov 08 13:55:33 2002

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:18 PM GMT GMT