fork download
  1. % 商品データ
  2. % product(商品名, 価格, 評価, レビュー数)
  3.  
  4. product(item1,3000,4.8,20).
  5. product(item2,1800,4.2,200).
  6. product(item3,5000,4.9,5).
  7. product(item4,2500,4.5,80).
  8.  
  9. % おすすめ商品(評価4.5以上)
  10. recommend(Name) :-
  11. product(Name, _, Rating, _),
  12. Rating >= 4.5.
  13.  
  14. % 実行
  15. main :-
  16. write('おすすめ商品'), nl,
  17. recommend(Name),
  18. write(Name), nl,
  19. main.
Success #stdin #stdout #stderr 0.02s 6948KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit