Adapted from:
F. Rabhi and G. Lapalme. Algorithms: A Functional Programming Approach.
    Addison-Wesley 1999.
http://www.iro.umontreal.ca/~lapalme/Algorithms-functional.html

An "import Ix" has been added to make the sources compile.
