/engines

Interactors (engines) for SWI-Prolog

Primary LanguageProlog

Paul Tarau style interactors for SWI-Prolog

This repo builds on the SWI-Prolog engine API to realise interactors. An interactor is a Prolog engine with, like a thread, its own stack. Unlike a thread however, it is not associated with an operating system thread.

This library allows for creating an engine from Prolog and ask this engine to perform some action. The action is performed by temporary associating the calling thread with the engine and to make it perform the action. After completion control is returned to the calling thread.

Interactors allow for implementing coroutines. As no OS thread is involved, interactors require less resources and are better suited for e.g., large agent simulations.

This is a temporary repository interactors will most likely end up in the core.

Installation

  • Get SWI-Prolog (swipl-devel.git) from the git version
  • Run make
  • Run swipl demo.pl and play with the demos.