This version of Learn Prolog Now! embeds SWI SH , SWI-Prolog for SHaring. The current version rewrites the Learn Prolog Now! HTML on the fly, recognising source code and example queries. It is not yet good at recognising the relations between source code fragments and queries. Also Learn Prolog Now! needs some updating to be more compatible with SWI-Prolog. All sources are on GitHub:
LearnPrologNow LPN SWISH Proxy SWISH

12.4 Exercises

Exercise  12.1 Write code that creates hogwart.houses , a file that that looks like this:

hufflepuff     ravenclaw

You can use the built-in predicates open/3 , close/1 , tab/2 , nl/1 , and write/2 .

Exercise  12.2 Write a Prolog program that reads in a plain text file word by word, and asserts all read words and their frequency into the Prolog database. You may use the predicate readWord/2 to read in words. Use a dynamic predicate word/2 to store the words, where the first argument is a word, and the second argument is the frequency of that word.

eXTReMe Tracker
© 2006-2012 Patrick Blackburn, Johan Bos, Kristina Striegnitz