As far as I know in Simple ML, tuples are being accessed via #ns and previously I have seen it working but now it does not work!
I have tried this following line:
val a =#2 ("one", "2", "three")
But it is giving me the following error back:
first.sml:25.26 Error: syntax error found at EOF
uncaught exception Compile [Compile: "syntax error"]
raised at: ../compiler/Parse/main/smlfile.sml:15.24-15.46
../compiler/TopLevel/interact/evalloop.sml:44.55
../compiler/TopLevel/interact/evalloop.sml:296.17-296.20
-
Weird!
Standard ML allows you to define your own arbitrary operators. This means that when you mix infix and prefix operators, you need to have spaces between them – otherwise they’d be interpreted as one operator.
In other words, SML thinks you’re trying to call the non-existent
=#operator in your code. If you add a space between the=and the#, it will work fine.