September 22, 1999 Strong Typing Slide #29

Merge Sort

        fun sort [] = []
          | sort x  = let val (p, q) = split x
                       in merge (sort p, sort q)
        val sort = fn : 'a list -> int list


This says that we could put in any sort of list

(which was not what we expected)

and that even if we put in a list of strings, we will still get a list of ints out.

(which is impossible)

Next Copyright © 1999 M-J. Dominus