TEXT   90
PrologMQI
Guest on 12th February 2023 10:37:48 AM


  1. from swiplserver import PrologMQI, PrologThread
  2.  
  3. with PrologMQI() as mqi:
  4.     with mqi.create_thread() as prolog_thread:
  5.         prolog_thread.query_async("member(X, [first, second, third])",
  6.                                   find_all=False)
  7.         while True:
  8.             result = prolog_thread.query_async_result()
  9.             if result is None:
  10.                 break
  11.             else:
  12.                 print(result)
  13. first
  14. second
  15. third

Raw Paste

Login or Register to edit or fork this paste. It's free.