Code from 'Paradigms of Artificial Intelligence Programming'.