Organise prolog code.
Add some code from the Scala chapter.