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

Get rid of fraction arithmetic patterns #351

Open
byorgey opened this issue Apr 16, 2022 · 3 comments
Open

Get rid of fraction arithmetic patterns #351

byorgey opened this issue Apr 16, 2022 · 3 comments
Labels
C-Moderate Effort Should take a moderate amount of time to address. S-Nice to have Minor importance Z-Student Good project for a student.

Comments

@byorgey
Copy link
Member

byorgey commented Apr 16, 2022

Currently,

Disco> f : Q -> N
Disco> f(2/4) = 6
Disco> f(1/2)
Error: value did not match any of the branches in a case expression.

In fact f is completely undefined, since the pattern 2/4 will never match anything; rational inputs are always reduced, and the numerator and denominator will be matched literally.

The above is a little strange, and maybe not worth fixing, but I think the below is more troubling:

Disco> f : F -> N
Disco> f(n/4) = n
Disco> f(1/2)
Error: value did not match any of the branches in a case expression.

I would expect to get 2 as a result.

@byorgey
Copy link
Member Author

byorgey commented Jan 21, 2023

Should sketch out a detailed design for the semantics of matching.

@byorgey byorgey added the C-Project A larger project that may take multiple days. label Aug 28, 2024
@byorgey
Copy link
Member Author

byorgey commented Aug 28, 2024

Related: #32 .

@byorgey byorgey changed the title Division arithmetic patterns should be more liberal wrt equality? Get rid of fraction arithmetic patterns Nov 5, 2024
@byorgey byorgey added Z-Student Good project for a student. C-Moderate Effort Should take a moderate amount of time to address. and removed Z-Research Project C-Project A larger project that may take multiple days. A-Under Review labels Nov 5, 2024
@byorgey
Copy link
Member Author

byorgey commented Nov 5, 2024

Another option is to just get rid of fraction patterns entirely. After hours of thinking about them, discussing with students, etc. I still can't really make heads or tails of what they are supposed to mean. They really aren't that useful either, so getting rid of them would just simplify a lot of things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Moderate Effort Should take a moderate amount of time to address. S-Nice to have Minor importance Z-Student Good project for a student.
Projects
None yet
Development

No branches or pull requests

1 participant