Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/games/factor



Martin Husemann <martin%duskware.de@localhost> writes:

> On Sun, May 16, 2010 at 07:30:54PM +0000, David Holland wrote:
>> of which at least the 0 case is clearly incorrect...
>
> That obviously depends on the meaning you give the output, which is
> not well defined in the man page and obviously a lot people around
> here disagree about.
>
> I would say the list of prime factors of 0 is empty, so "0:\n" makes
> perfect sense to me.

Which is wrong because product over empty set, tuple, or list, depending
on how you define it, is multiplicative unit. And zero isn't multiplicative 
unit.
This isn't arbitrary, it makes less special cases such as in

forall x, y  (product over x)*(product over y) = (product over union(x, y))

If any of x and y is empty, you should either have unit product or special-case.

If you studied computer science, you know that

[1]> (and)
T
[2]> (*)
1
[3]> (or)
NIL
[4]> (+)
0

and corresponding in Scheme

guile> (and)
#t
guile> (*)
1
guile> (or)
#f
guile> (+)
0

And this again isn't neither accidential nor arbitrary.


-- 
HE CE3OH...

Attachment: pgpryOMHbBxm3.pgp
Description: PGP signature



Home | Main Index | Thread Index | Old Index