Prolog.asserta, Prolog.assertz, Prolog.retract, Prolog.query methods take a format and optional arguments to convert Python values to strings.
The following types are recognized:
String
Integer
Float
pyswip.Atom
pyswip.Variable
Lists of the types above
Other types are converted to strings using the str function.
Enhancements
Python to Prolog Placeholders
Prolog.asserta
,Prolog.assertz
,Prolog.retract
,Prolog.query
methods take a format and optional arguments to convert Python values to strings. The following types are recognized:pyswip.Atom
pyswip.Variable
Other types are converted to strings using the
str
function.The placeholders are set using
%p
.Example:
Added more examples
Moved The Towers of Hanoi example to
pyswip.examples.hanoi
package. For example, here is how to solve the puzzle with 5 disks:Or:
It is also available via the command line:
Similarly, Coins example was moved to
pyswip.examples.coins
package.