Closed ConnyOnny closed 3 years ago
I have never seen that notation before, and I'm really hesitant to add it if it's really specific to one format (pesto). Is there a reason you can't just implement this in your own pesto parser?
Is the notation with a space (e.g. "3 1/2") more common? Would you accept the feature, if it could also accept this format?
Is there a reason you can't just implement this in your own pesto parser?
That is exactly what I am going to do, if this feature does not make it into num-rational ;-)
Is the notation with a space (e.g. "3 1/2") more common? Would you accept the feature, if it could also accept this format?
Yes, a space is more common, but in mathematical use it's most common to just use improper fractions.
I'm inclined to say that even that mixed format would be better as a separate method, to make it clear about different expectations. I still probably wouldn't include the pesto format in that, unless maybe we made the "separator" an explicit argument?
Is there a reason you can't just implement this in your own pesto parser?
That is exactly what I am going to do, if this feature does not make it into num-rational ;-)
Honestly, I think that's probably best for such a specialized format.
I added parsing of mixed numerals (e.g. "3/1/2" for three and a half), because I need it for implementing pesto.
Unfortunately it's a breaking change, because I had to add
CheckedMul
andCheckedAdd
constraint for parsing. But I expect that every sane Integer also implements these two.Feedback is very welcome.