Something that perhaps could be added is that leaving 0 `gcd` 0 undefined has two obvious annoying consequences: gcd is no longer idempotent (i.e. we don't have a `gcd` a = a, for all a), and it is no longer associative ((a `gcd` 0) `gcd` 0 is well-defined whilst a `gcd` (0 `gcd` 0) is not).
(We actually wrote something about this on a recent paper. If you're interested, see http://www.joaoff.com/publications/2009/euclid-alg )
Regards,
Joao
> This, to defend myself, was not how it was explained in high school.No worries. I didn't realize this myself until college; most nonspecialist teachers just don't know any better. Nor did, it appears, the original authors of the Haskell Prelude. :)
BTW, this definition of gcd makes it possible to consider gcds in rings that otherwise have no natural order- such as rings of polynomials in several variables, group rings, et cetera.
Nathan Bloomfield
On Sun, May 3, 2009 at 11:16 AM, Achim Schneider <barsoap@web.de> wrote:Nathan Bloomfield <nbloomf@gmail.com> wrote:This, to defend myself, was not how it was explained in high school.
> The "greatest" in gcd is not w.r.t. the canonical ordering on the
> naturals; rather w.r.t. the partial order given by the divides
> relation.
>
--
(c) this sig last receiving data processing entity. Inspect headers
for copyright history. All rights reserved. Copying, hiring, renting,
performance and/or quoting of this signature prohibited.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe