A notebook is a list of cells. Notebooks are different from a program with examples because they can tell a story, mixing properly formatted text with knowledge bases and queries. The story is interactive. The reader can edit program fragments and/or queries and see the result. This makes notebooks particularly interesting for writing tutorials as well as writing cookbooks that document data analysis and transformation steps. A Prolog notebook supports three types of cells:
Creating and managing a notebook is supposed to be intuitive. Below we describe the first starting point as well as some less obvious operations.
[All about lists](lists.swinb)
A notebook query cell is executed against the program cell above it and all program cells marked as background using the button. Click the button to turn a normal program cell into a background cell.
Longer fragments of code that are required throughout a notebook and
possibly on multiple notebooks are defined in a program tab,
saved and included using, e.g.,
:- include(mybasics). in a
background program kept at the bottom of the notebook.
If you want to have multiple related queries in a notebook you can add a background program at the end of the notebook and above this program pairs of a normal program and query where the normal program provides data and/or parameters by defining predicates that are missing from the background program.