[m-rev.] for review: bug fix for try_all/2

Ian MacLarty maclarty at cs.mu.OZ.AU
Thu Dec 9 12:08:04 AEDT 2004


On 8 Dec 2004, at 20:01, Ian MacLarty wrote:

>
> On 8 Dec 2004, at 18:50, Mark Brown wrote:
>>
>> @@ -141,8 +140,9 @@
>>  	%	try_all(Goal, Results),
>>  	%	std_util__unsorted_aggregate(Results, AccumulatorPred,
>>  	%		Acc0, Acc)
>> -	% except that operationally, the execution of try_all
>> -	% and std_util__unsorted_aggregate is interleaved.
>> +	% except that declaratively, the exception is placed at the end
>> +	% of the list if it exists, and that operationally, the execution
>> +	% of try_all and std_util__unsorted_aggregate is interleaved.
>
> I don't think the bit about the the exception being placed at the end 
> is relevant, since declaratively unsorted_aggregate doesn't apply the 
> accumulator in any particular order.  Also I couldn't find a signature 
> of unsorted_aggregate that matches the one here (i.e that takes a list 
> as the first argument), so I suggest we change the declarative meaning 
> to:
>
> try_all(Goal, Results),
> list.perm(Results, ShuffedResults),
> list.foldl(AccumulatorPred, ShuffedResults, Acc0, Acc)

Or maybe it should be:

try_all(Goal, Results),
list.foldr(AccumulatorPred, Results, Acc0, Acc)

This does assert that the exception will be the last thing 
AccumulatorPred will be applied to (because of the definition of 
try_all), but doesn't say anything about the order of the successes.

Ian.

--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list