Creating Documents with Editable and Runnable Examples

The Ciao Prolog Playground provides several easy ways for creating documents with editable and runnable examples. This includes:

  • Creating Active Logic Documents: notebooks containing embedded runnable Prolog code examples, that can be edited, queried, etc.

  • Embedding links to runnable examples and notebooks in arbitrary documents.

Creating notebooks: Active Logic Documents (ALDs)

The playground allows easily generating Active Logic Documents (ALDs): notebooks containing embedded runnable Prolog code examples, that can be edited, queried, etc.

This is an example of a simple exercise:

  1. Click on this link to open it.

  2. Click on the pencil button on the top right to edit the document in the playground.

  3. See the playground usage page for other functionality available.

  4. In particular, clicking the Share! button will copy into the clipboard a link that can be used to open the document. This link can be sent by email, embedded in notes, etc.

ALD notebooks are very useful for developing tutorials, exercises, slides, manuals, etc. and in general any kind of document with runnable Prolog examples. The source for these documents is in (LPdoc) markdown and they can be easily shared, as shown in the example above. The documents and the embedded code run locally on the user's browser, without the need for a server. This provides many advantages such as scalability to any number of users, privacy, efficiency, etc.

This functionality is provided by an integration of LPdoc with the playground. The Editable and runnable examples and Documentation markdown language chapters of the LPdoc manual provides a description of the markdown syntax and other commands that can be used in ALDs.