Some Scheme code to (efficiently) solve toy problems for a university assignment