Polymorphism in untyped languages

Polymorphism is fundamentally an issue of types. Thus, it is a trivial issue is untyped languages, where all variables are potentially polymorphism. This is illustrated by this rather contrived simple example. Here a silly function takes a single argument. If the argument happens to be an integer, the function returns the next higher value. If the argument happens to be a fraction, it returns the recipricol. If the argument is a string, it returns the reverse of the string. Otherwise, it returns a null value.

[audio] [real] Text to accompany slide4, in Chapter 14 of An Introduction to Object-Oriented Programming