September 22, 1999 Strong Typing Slide #16

Types in ML

                3 + 4.5                 (* Compile-time type error *)
                real(3) + 4.5           (* OK; result is 7.5 : real *)
        real                            int -> real
        floor                           real -> int
        sqrt                            real -> real
        not                             bool -> bool
        explode                         string -> string list
        mod                             int * int -> int
        rev                             'a list -> 'a list
        ::                              'a * 'a list -> 'a list

h::t is a list with head h and tail t.

        1::2::3::[]
        [1,2,3]


Next Copyright © 1999 M-J. Dominus