[m-dev.] diff: lpQ - new module for linear programming over Q

Andrew Bromage bromage at cs.mu.OZ.AU
Fri Mar 13 12:35:45 AEDT 1998


G'day all.

Just a comment or two.

Vanessa Joy TEAGUE wrote:

> compiler/rat.m:

Is there a reason why this isn't going in the library?  (Apart from being
incomplete for library purposes, but that's never stopped us in the past.)

Under the assumption that putting it in the library is a good idea, I
have some suggestions.  If this is a bad idea, ignore what follows.

> :- pred rat:'<'(rat, rat).
> :- mode rat:'<'(in, in) is semidet.

It might be worth a comment or two that compare/3 on rationals doesn't
do the most natural thing.

> :- func one = rat.
> :- func zero = rat.

These two seem a little arbitrary.  Perhaps a rat/1 function to go with
the rat/2 might work.

	rat(Num) = r(Num, 1).

> :- func gcd(int, int) = int.
> 
> gcd(A, B) = Res :-
> 	( A = 0 ->
> 		Res = B

This doesn't look quite like "standard" gcd behaviour.  Perhaps a comment
or two for the benefit of the next hacker who comes along wanting a gcd
implementation and just lifts yours without thinking?

Cheers,
Andrew Bromage



More information about the developers mailing list