Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

factorize should be more limited #32

Open
sorawee opened this issue Dec 29, 2019 · 3 comments
Open

factorize should be more limited #32

sorawee opened this issue Dec 29, 2019 · 3 comments

Comments

@sorawee
Copy link
Contributor

sorawee commented Dec 29, 2019

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.

@sorawee
Copy link
Contributor Author

sorawee commented Dec 29, 2019

Also, regardless of this, the type of the co-domain could be strengthen to (Listof (List Positive-Integer Positive-Integer)).

@soegaard
Copy link
Member

Wait. Isn't (factorize 0) = '() simply an mistake?

The empty product is 1, so an empty list of factors represents 1.

@pavpanchekha
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants