SWI-Prolog / roadmap

Discuss future development
21 stars 3 forks source link

Tutorials #10

Open wouterbeek opened 9 years ago

wouterbeek commented 9 years ago

The SWI Web site needs three ways of describing each library/topic (a topic may involve multiple libraries, e.g., the topic "Building industry-strength Web Services" will inevitable involve multiple libraries):

  1. A short, high-level description. What it is / what it does. This should interest the Future Prolog User.
  2. A tutorial that explains the basics in easy yet cool examples.
  3. A detailed documentation of all the public predicates, options, theoretical and practical considerations.

Present tutorials

Incomplete/outdated tutorials Great tutorial that only need a bit of polishing to be ok to go.

Missing tutorials

Anniepoo commented 9 years ago

Other useful tutorials:

Additional incomplete tutorials:

[Thanks for the input! This is now integrated into the issue. -- Wouter]

Anniepoo commented 9 years ago

I agree wholeheartedly with: The SWI Web site needs three ways of describing each library/component:

A short, high-level description. What it is / what it does. This should interest the Future Prolog User. A tutorial that explains the basics in easy yet cool examples. A detailed documentation of all the public predicates, options, theoretical and practical considerations.

My only comment would be that there's not a bijection between library/component and tutorial topic in some cases.

[Thanks for the input! This is now integrated into the issue. -- Wouter]

triska commented 9 years ago

Great list Wouter!

Regarding CLP(FD), here are some excellent resources:

A CLP(FD) tutorial by Ulf Nilsson

http://ima.udg.es/Docencia/3105IG0017/clpfd.pdf

All code examples work with SWI-Prolog after at most minimal adaptations (like replacing domain/3 by ins/2). This is the tutorial that motivated me to implement cumulative/2 and circuit/1 in SWI's library(clpfd), so that users can reproduce all results shown in this tutorial.

High performance declarative programming (lecture notes)

https://github.com/szarnyasg/ndp

For CLP(FD), see in particular: https://github.com/szarnyasg/ndp/blob/master/clp5.tex

These notes cover many more language elements that are SICStus-specific, but some examples are still useful also in the context of SWI-Prolog.

In my view, the only shortcoming of these two documents is that they do not yet push CLP(FD) to its ultimate consequence, namely as a general substitute for all integer arithmetic. However, they are great for the combinatorial part.

The CLP(FD) documentation itself separates the declarative integer and combinatorial aspects to stress the former point:

http://eu.swi-prolog.org/man/clpfd.html

Great usage examples of CLP(FD) constraints

The following examples nicely demonstrate how CLP(FD) constraints are meant to be used for integer arithmetic in modern Prolog code, increasing generality and allowing a completely declarative reading in many situations that also makes Prolog easier to teach and understand:

patch.pl by Michael Hendricks

movement.pl by Erik Peldan

The calendar example by Michael Hendricks, which you already linked to, is also a great.

Anniepoo commented 9 years ago

http://www.ida.liu.se/~TDDD08/misc/clpfd.pdf

is password protected