ss@arovane % sml ~ Standard ML of New Jersey v110.52 [built: Fri Jan 21 16:42:10 2005] - (* 2.2.1 *) - val x = 123.45; val x = 123.45 : real - floor(x); trunc(x); round(x); val it = 123 : int val it = 123 : int val it = 123 : int - floor(~x); val it = ~124 : int - ceil(x); val it = 124 : int - ceil(~x); trunc(~x); val it = ~123 : int val it = ~123 : int - ord(#"Y"); val it = 89 : int - chr(120); val it = #"x" : char - real(ord(#"N")); val it = 78.0 : real - chr(trunc(97.0)); val it = #"a" : char - str(#"Z"); val it = "Z" : string - (* 2.2.2 *) - ceil(4); (* ceil(4.0) *) stdIn:13.1-13.8 Error: operator and operand don't agree [literal] operator domain: real operand: int in expression: ceil 4 - if true then 5+6 else 7.0; stdIn:1.1-2.14 Error: types of if branches do not agree [literal] then branch: int else branch: real in expression: if true then 5 + 6 else 7.0 - chr(256); uncaught exception Chr raised at: smlnj/init/built-in.sml:350.17-350.20 - chr(~1); uncaught exception Chr raised at: smlnj/init/built-in.sml:350.17-350.20 - ord(3); stdIn:1.1-1.7 Error: operator and operand don't agree [literal] operator domain: char operand: int in expression: ord 3 - chr(#"a"); stdIn:1.1-1.10 Error: operator and operand don't agree [tycon mismatch] operator domain: int operand: char in expression: chr #"a" - if 0 then 1 else 2; stdIn:1.1-2.7 Error: test expression in if is not of type bool [literal] test expression: int in expression: if 0 then 1 else 2 - ord("a"); stdIn:1.1-1.9 Error: operator and operand don't agree [tycon mismatch] operator domain: char operand: string in expression: ord "a" -