Most of us use imperative programming languages like C Python or Java at home. But the universe of programming languages is endless and there are languages where no imperative command has gone before. That which may sound impossible at the first glance is feasible with Prolog and other so called declarative languages. This article will demonstrate how to split a programming task between Python and Prolog.
In this article I do not want to teach Prolog. There are resources available for that. We will demonstrate how simple it is to solve a puzzle solely by describing the solution. After that it is up to the reader how far this idea will take them. .
To proceed you should have a basic understanding of Python. Installation of Prolog and the Python-Prolog bridge is accomplished using this command.
dnf install pl python3-pyswip.
Our exploration uses SWI-Prolog an actively developed Prolog which has the Fedora package name 8220pl8221. The PythonSWI-Prolog bridge is pyswip.