yuce / pyswip

PySwip is a Python - SWI-Prolog bridge enabling to query SWI-Prolog in your Python programs. It features an (incomplete) SWI-Prolog foreign language interface, a utility class that makes it easy querying with Prolog and also a Pythonic interface.
MIT License
464 stars 97 forks source link

Operating with dictionaries in pyswip #141

Open Losbarthos opened 2 years ago

Losbarthos commented 2 years ago

Based on this introduction about dictionaries, I just tried the following statement:

from prolog import *

pl = Prolog()
#pl.consult("logic.pl")
print(list(pl.query("X = point{x:1,y:2}.C.")))

expected output: [{'X': 1, 'C': x}, {'X': 2, 'C': y}]

actual output: [{'X': ".(Atom('26501')(point, 1, x, 2, y), _3198)", 'C': Variable(101)}, {'X': ".(Atom('26501')(point, 1, x, 2, y), _3198)", 'C': Variable(80)}]