Standard ML does not allow equality comparison of real numbers, as they are approximations. You have instead to check e.g. if x is sufficiently small, e.g. y < 1E~20. You also have to declare the exception DivByZero, but perhaps that was in code you did not show?
When you ask for assistance, please be specific about the error. In this case it was obvious, but generally it is difficult to help if you don't give the complete error message. Also, you showed two lines of code, so what would "line 4" be?
Lars-Henrik Eriksson, PhD, Senior Lecturer, Distinguished University Teacher Programme Coordinator for the Master Programme in Computer Science Computing Science, Dept. of Information Technology, Uppsala University, Sweden
20 jan. 2026 kl. 22:43 skrev Duke Normandin sidney.reilley.ii@gmail.com:
This function:
fun divide (x: real, y: real) = if y = 0.0 then raise DivByZero 5 else x / y;
is taken from: "Beginner's Guide to Standard ML"
It's part of a "calculator" program included in the document.
I'm using: $ poly --use ./calc.sml Poly/ML 5.9.2 Release
and it chokes and quits at line 4 on the above function. I made no typo! So! What now? Why doesn't Poly/ML not like that code? TIA ... -- Duke _______________________________________________ Poly/ML mailing list -- polyml@lists.polyml.org To unsubscribe send an email to polyml-leave@lists.polyml.org
När du har kontakt med oss på Uppsala universitet med e-post så innebär det att vi behandlar dina personuppgifter. För att läsa mer om hur vi gör det kan du läsa här: http://www.uu.se/om-uu/dataskydd-personuppgifter/
E-mailing Uppsala University means that we will process your personal data. For more information on how this is performed, please read here: http://www.uu.se/en/about-uu/data-protection-policy