Closed DavidJilg closed 7 months ago
You'd probably better ask on Discourse as more people look there. Didn't MQI do a findall/3? You implementation produces an infinite number of results, so a findall/3 will not complete (well, eventually runs out of memory).
Thank you for the hint! However, I wonder why the GUI version returns a single result if an infinite number of results are produced and the MQI does not. Is the difference in behavior intended?
Well, I don't know what you mean by the GUI version, ut if I run the query in the commandline I can keep hitting ";" and get more and more answers.
Sorry, I was not aware that you could enter ";" and get more results. I was pressing Enter, and it would stop after one result. It seems there was no Problem after all, and I misjudged the issue because I am not that familiar with SWI-Prolog. Sorry for the confusion.
There appears to be a problem with the Machine Query Interface (at least when called from Python using the swiplserver library) that results in queries reaching a timeout, while the same queries produce an almost instant result in the GUI. The following example illustrates the problem:
Example
Consider the following Prolog implementation of the TAK-function (I am aware that it is not a correct implementation of the function).
When executing the query
tak(1, 2, 3, R).
, the GUI version of SWI-Prolog returns an almost instant result:\
However, when executing the same query through the MQI interface using the python library swiplserver, and the following implementation, the query results in a timeout even when setting a high timeout time (maximum that I tried is 1000 seconds).
Other Prolog programs work fine with this implementation. I am using SWI-Prolog version 9.2.1 for x64-win64 on Windows 11 Pro Version 10.0.22631 Build 22631.