[Haskell-cafe] Re: gcd

Daniel Fischer daniel.is.fischer at web.de
Sat May 2 22:34:44 EDT 2009


Am Sonntag 03 Mai 2009 00:17:22 schrieb Achim Schneider:
> Steve <stevech1097 at yahoo.com.au> wrote:
> > "It is useful to define gcd(0, 0) = 0 and lcm(0, 0) = 0 because then
> > the natural numbers become a complete distributive lattice with gcd
> > as meet and lcm as join operation. This extension of the definition
> > is also compatible with the generalization for commutative rings
> > given below."
>
> Ouch. Speak of mathematicians annoying programmers by claiming that 0
> isn't divisible by any of [1..],

Beg pardon? 0 is divisible by all of them. And while we're talking about rings, 0 is also 
divisible by 0.


> and further implying that 0 is bigger
> than all of those,

'Tis, in the divisibility preorder :)

> not to mention justifying all that with long words.

Sorry for the long words, but having gcd 0 0 == lcm 0 0 == 0 is the sensible thing and 
having it differently in Haskell is a bad mistake (IMO).

>
> Damn them buggers.



More information about the Haskell-Cafe mailing list