[m-rev.] For review: Declarative debugger documentation

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Oct 1 14:57:57 AEST 2004


On 30-Sep-2004, Ian MacLarty <maclarty at cs.mu.OZ.AU> wrote:
> +For example consider the following fragment of a program that calculates
> +payments for a loan:
> +
> + at example
> +	:- type payment
> +		--->	payment(
> +				date	:: date,
> +				amount	:: float
> +			).
> +	
> +	:- type date ---> date(int, int, int).  % date(day, month, year).
> +	
> +	:- pred get_payment(loan::in, int::in, payment::out) is det.
> +
> +	get_payment(Loan, PaymentNo, Payment) :-
> +		get_payment_amount(Loan, PaymentNo, Amount),
> +		get_payment_date(Loan, PaymentNo, Date),
> +		Payment = payment(Date, Amount).
> +	
> + at end example
> +
> +Suppose that get_payment produces an incorrect result and the declarative

I suggest inserting "@noindent" here.

> +debugger asks:
> +
> + at example
> +	get_payment(loan(...), 10, payment(date(9, 10, 1977), 10.000000000000).
> +	Valid?
> + at end example
> +
> +Then if we know that this is the right payment amount for the given loan, 
> +but the date is incorrect, we can mark the date(...) subterm and the 

And here.

> + at example
> +	get_payment(loan(...), 10, payment(date(9, 10, 1977), 23.45)).
> +	Valid? browse
> +	browser> cd 3/1
> +	browser> mark
> +	get_payment_date(loan(...), 10, dat(9, 10, 1977)).
> +	Valid?
> + at end example
> +	
> +Thus irrelevant questions about get_payment_amount are avoided.

And here.

P.S. I didn't review the code, but judging from the docs and the log
message, that looks like a big improvement!

-- 
Fergus Henderson                    |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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