[CS Dept logo]

Higher-Order Programming

Lecture Notes for Com Sci 221, Programming Languages

Last modified: Mon Nov 22 09:17:50 CST 1999


Start Friday 19 November 1999

ML Examples

I haven't had time to type real notes for this section yet. Here are some thought-provoking examples of higher-order programming in ML with polymorphic types. They are not intended to be directly practical, but they're a bit closer than the Scheme examples. The anagram dictionary example could be part of a very practical program. The examples where type inference fail suggest the value of an even richer system of polymorphic typing, where type parameters can be bound explicitly by a lambda-like operator, just like parameters of functions. In the anagram dictionary example, I gave partial definitions of the functions anasort and anadict. The ellipses (...) are not part of ML---they indicate where you need to fill in additional code to make the definitions work.