Exercise for the book Programming Language Concepts