Scheme implementation in Python inspired by P. Norvig