I am currently using the latest version of Pyswip and I have a problem in getting the correct representation of incomplete structures.
For example, in Prolog an incomplete list would look like: L = [1,2,3 | _].
My code:
prolog = Prolog()
query_string = "L=[1,2,3,_|_]"
results = list(prolog.query(query_string))
for result in results:
print(result)
The result is:
{'L': [1, 2, 3, Variable(77)]}
If I use
LS = [1,2,3 | LE], LE = [4,5 | _]
I get
{'LS': [1, 2, 3, 4, 5], 'LE': [4, 5]}
I understand that it is quite complicated to translate such structures directly into a Python list, but I was wondering what alternatives are there. How could I get the incomplete structure representation (maybe as a string instead of a list)?
I am currently using the latest version of Pyswip and I have a problem in getting the correct representation of incomplete structures. For example, in Prolog an incomplete list would look like: L = [1,2,3 | _].
My code:
The result is:
{'L': [1, 2, 3, Variable(77)]}
If I use
LS = [1,2,3 | LE], LE = [4,5 | _]
I get{'LS': [1, 2, 3, 4, 5], 'LE': [4, 5]}
I understand that it is quite complicated to translate such structures directly into a Python list, but I was wondering what alternatives are there. How could I get the incomplete structure representation (maybe as a string instead of a list)?