Copied from https://www.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/scheme/impl/pcscheme/cwh/0.html