I have seen so many people tripped on this one.
In the following code, the if-expression is given the type X,
which is checked to be a subtype of 'int':
val newN: int =
if nn % 2 = 0 then nn / 2 else 3 * nn + 1
When you do the following later,
val () = println! ("newN = ", newN)
you will get a type-error message stating that the print function
for newN cannot be found.
Instead, please use the following style of type annotation:
val newN = (if nn % 2 = 0 then nn / 2 else 3 * nn + 1): int
I hope to find a way to address this issue in ATS3.
--
You received this message because you are subscribed to the Google Groups
"ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/2c06dcda-0e00-4348-a7ea-364f2c2b0b2f%40googlegroups.com.