September 22, 1999 Strong Typing Slide #15

Types in ML

        17                              int
        17.3                            real
        "brain d foy"                   string
        true                            bool
        (17, "foo")                     int * string
        (12.5, 13.5, 9)                 real * real * int
        (true, false, true)             bool * bool * bool
        [true, false, true]             bool list
        [true, false, true, false]      bool list
        [1,2,3,4,5]                     int list
        ["brain", "d", "foy"]           string list
        [17, "foo"]                     ILLEGAL
        [ [1,2,3], [4,6], [0,233] ]     int list list
        []                              'a list   
        [ [1,2,3], [], [] ]             int list list
        [ ["b", "d", "f"], [], [] ]     string list list
        [ (true, [...]), 
          (false, [...]),
          (false, [...]) 
        ]                               (bool * 'a list) list


Next Copyright © 1999 M-J. Dominus