fork download
  1. % 商品データ
  2. product(item1,3000,4.8,20).
  3. product(item2,1800,4.2,200).
  4. product(item3,5000,4.9,5).
  5. product(item4,2500,4.5,80).
  6.  
  7. % 評価4.5以上
  8. high_rating(Item) :-
  9. product(Item, _, Rating, _),
  10. Rating >= 4.5.
  11.  
  12. % 価格3000円以下
  13. affordable(Item) :-
  14. product(Item, Price, _, _),
  15. Price =< 3000.
  16.  
  17. % レビュー50件以上
  18. popular(Item) :-
  19. product(Item, _, _, Reviews),
  20. Reviews >= 50.
  21.  
  22. % おすすめ商品
  23. recommended(Item) :-
  24. high_rating(Item),
  25. affordable(Item),
  26. popular(Item).
Success #stdin #stdout #stderr 0.02s 6980KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit