Another example
fun is_empty nil = true | is_empty (_::_) = false;
val is_empty = fn : ‘a list -> bool
This is a polymorphic function
- It must take a list
- But it can take a list of anythings
- Those “anythings” are represented by the type variable ‘a
- We’ll see examples where a type variable appears twice in the function type, and they must be the same