
On 5/28/11 6:59 AM, Daniel Fischer wrote:
The Proposal:
I would like to propose the elimination of the special error case
gcd 0 0 = error "Prelude.gcd: gcd 0 0 is undefined"
to replace it with
gcd 0 0 = 0
(which would be an automatic consequence of removing the above line).
Rationale:
1. It makes gcd a total function. 2. It makes gcd associative. 3. It makes folding gcd over a list safe. 4. It conforms to common mathematical practice:
Just in case I'm not already on the record for this one, +1. The only con I can envision is that, in the general case, the uniqueness of gcd is guaranteed by various properties; whereas every number is a divisor of 0. So, given the uniqueness criterion one could make an argument. However, the common mathematical practice takes gcd 0 0 == 0, and I'm unaware of a compelling reason not to do so. -- Live well, ~wren