On Wed, 21 Jan 2026 10:10:55 +0000 David Matthews David.Matthews@prolingua.co.uk wrote:
It's not surprising you're having problems. The code on that website has at least two errors. Others have already pointed out that the "real" type is not an equality type so "y = 0.0" is not allowed. But there's a more glaring error in that the exceptions are used before they are declared. It's a general principle in ML that identifiers have to be declared before they are used so the declaration exception DivByZero; needs to be moved above the declaration fun divide ...
It doesn't look as though this code has ever been tested.
My bad luck to stumble on a sub-standard resource! Thanks for pointing that out.
I'm sure there are better introductions to Standard ML available. Larry Paulson's book "ML for the Working Programmer" is still available but perhaps rather expensive.
I have it on order. Should be here soon - I hope. Thanks again ....