(* ** ** Course: Concepts of Programming Languages (BU CAS CS 320) ** Semester: Summer I, 2009 ** ** Instructor: Hongwei Xi (hwxi AT cs DOT bu DOT edu) ** *) (* ****** ****** *) val char_a = 'a' val char_A = 'A' fun isLower (c: char): bool = if c >= 'a' andalso c <= 'z' then true else false fun isUpper (c: char): bool = if c >= 'A' andalso c <= 'Z' then true else false fun digit_of_int (i: int): char = char_of_int (int_of_char '0' + i) fun xdigit_of_int (i: int): char = begin if i <= 9 then char_of_int (int_of_char '0' + i) else char_of_int (int_of_char 'a' + i - 10) end // end of [xdigit_of_int] fun title (name: string): string = "The Duke of " + name (* ****** ****** *) implement main () = let val () = begin print "digit_of_int (5) = "; print (digit_of_int 5); print_newline () end (* end of [val] *) val () = begin print "xdigit_of_int (5) = "; print (xdigit_of_int 5); print_newline () end (* end of [val] *) val () = begin print "xdigit_of_int (10) = "; print (xdigit_of_int 10); print_newline () end (* end of [val] *) in // empty end // end of [main] (* ****** ****** *) (* end of [lecture01_misc.dats] *)