0

My program:

val a = chr 65 : char
val b = Char.chr 65: char
val _ = print (Char.toString a)
val _ = print (Char.toString b)

Output:

AA

Lines 1 and 2 show that both chr and Char.chr work.

Is there a difference between the two? And which one is conformant to Standard ML 97 and why?

1 Answer 1

1

They are the same function. Char.chr is simply available at the top-level of any SML program unqualified by its module name, along with several other useful functions and operators.

Should you bind the name chr to another value at the top-level of your program, the original would still be available via the fully-qualified name Char.chr.

Further reading

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.