math
math copied to clipboard
factorize should be more limited
It would be ideal if factorize
is injective. It is not right now due to how (factorize 0)
= (factorize 1)
= '()
. Changing the type of the domain to Positive-Integer
is one possibility to accomplish this.
Also, regardless of this, the type of the co-domain could be strengthen to (Listof (List Positive-Integer Positive-Integer))
.
Wait. Isn't (factorize 0) = '()
simply an mistake?
The empty product is 1, so an empty list of factors represents 1.
I agree, (factorize 0)
should raise an error or return ((0 1))
or something else but definitely not return '()
. The easiest fix is definitely to change the domain to Positive-Integer
.