/LearnPrologNow-Solutions

My solutions for the exercises and practical sessions of the online book "Learn Prolog Now!"

Primary LanguageProlog

Learn Prolog Now! Solutions

My solutions (in SWI-Prolog) to the exercises and practical sessions of the online book "Learn Prolog Now!"

What to Know

All problems are solved assuming we only have the knowledge gained so far at the time of the problem.

Some predicates and cuts were added to some earlier files to ensure they're working fine. I added to some files the ensure_loaded/1 predicate to, you know, ensure loaded. Also, module/2 was used on two files for the final practical session.

The predicates are named exactly (or relevantly) as they are in the book. The file names of all DCGs have the prefix dcg. The solution for exercise 12.2 is readfilefreq.pl, and the solution for the practical session for chapter 12 is testsuite.pl.

Most straightforward predicates are not commented. More complicated ones are explained. Some have self-explanatory variable names.

Though, I tried to solve every single problem, even the simple ones, it is probable that I have missed some predicates in the early few chapters.

License

There is none. Mi code es su code.