- from swiplserver import PrologMQI, PrologThread
- with PrologMQI() as mqi:
- with mqi.create_thread() as prolog_thread:
- prolog_thread.query_async("member(X, [first, second, third])",
- find_all=False)
- while True:
- result = prolog_thread.query_async_result()
- if result is None:
- break
- else:
- print(result)
- first
- second
- third
Raw Paste