0

I have a simple Prolog predicate that spits accepts a variable, Result, that calculates a result then stores it in Result to be viewed. Sometimes I'm unsure how it comes to the answer it stores in Result and I'm curious if there's a way in Prolog to get it to show how it got to the answer, I guess show the path it took and how it built it up?

The predicate is something simple like solve(Input, Result). and Result can sometimes be peculiar.

repeat
  • 18,496
  • 4
  • 54
  • 166
Doug Smith
  • 29,668
  • 57
  • 204
  • 388
  • You can use graphical debugger in SWI-Prolog: http://www.swi-prolog.org/gtrace.html – Grzegorz Adam Kowalski Sep 28 '15 at 20:07
  • [Almost every prolog implementation](https://en.wikipedia.org/wiki/Comparison_of_Prolog_implementations) includes a way to debug code, it seems. It's just a matter of looking up the documentation for whatever you're using. – vmg Sep 29 '15 at 01:53

0 Answers0