Re: [sorted] Am I missing something?

From: Warwick Harvey <wh_at_icparc.ic.ac.uk>
Date: Fri 08 Nov 2002 02:23:41 PM GMT
Message-ID: <20021108142340.C8457@tempest.icparc.ic.ac.uk>
Hi Marc,

(High embarrassment factor alert.  :)

On Fri, Nov 08, 2002 at 02:52:07PM +0000, Marc van Dongen wrote:
> 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, _ ),

Look closely.  They aren't O2 and O3, they are 02 (2) and 03 (3).  Hence
your output.

Cheers,
Warwick
Received on Fri Nov 08 14:23:46 2002

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