The Power of Prolog

repository·master·Indexed 23 days ago

https://github.com/triska/the-power-of-prolog

An educational resource and book focusing on modern Prolog constructs and features. The documentation includes a self-hosting HTTP server requiring Scryer Prolog and provides guidance on running code examples using ISO standard compliant systems such as SICStus Prolog, Scryer Prolog, and GNU Prolog.

Tokens
592
Snippets
4
Records
6
Agent score
30%

What's inside The Power of Prolog

  1. Run the local documentation server

    master

    The book is self-hosting and includes an HTTP server that allows you to browse most content locally. To run the server, you must use Scryer Prolog.

    To spawn the server on port 6012, execute the following command and then navigate to http://localhost:6012/prolog in your web browser.

    $ scryer-prolog -g "server(6012)" server.pl
  2. Requirements for running code examples

    master

    To run the code examples provided in the book, use any Prolog implementation that conforms to the ISO standard and provides the following conforming extensions:

    • Constraints like dif/2 and declarative integer arithmetic.
    • Alternative execution strategies such as SLG resolution.

    Recommended Prolog systems include:

    • SICStus Prolog: A state-of-the-art, ISO standard compliant system.
    • Scryer Prolog: A modern implementation written mostly in Rust.
    • GNU Prolog: A free compiler with constraint solving over finite domains.

    Note on String Handling: The examples assume the Prolog flag double_quotes is set to chars (interpreting double-quoted strings as lists of characters). This is the default in Scryer Prolog, Tau Prolog, Trealla Prolog, and ichiban/prolog.

  3. Generate LaTeX tables from benchmark results

    master

    Benchmark results are produced as Prolog facts. To convert these facts into LaTeX table rows for documentation, follow these steps:

    1. Copy the generated Prolog facts into a file named facts.pl.
    2. Run the latex_table goal using swipl against the benchmark script and your facts file.
    $ swipl -g latex_table -t halt bench.pl facts.pl