Picat Exception Handling and Debugging Flashcards
6 cards from real Picat practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 6 Picat Exception Handling and Debugging flashcards as text
Which built-in activates Picat's execution tracer for debugging?
Answer: trace
`trace` activates the Picat tracer, printing each goal as it is called, exited, or failed.
What does `spy(Predicate)` do in Picat?
Answer: Sets a breakpoint on a specific predicate
`spy(Predicate)` sets a spy point so the debugger activates only when that predicate is called.
Which predicate prints the current execution call stack in Picat?
Answer: print_backtrace
`print_backtrace` prints the current execution stack, which is helpful for diagnosing errors.
How do you measure the execution time of a goal in Picat?
Answer: time(Goal)
`time(Goal)` executes Goal and prints the elapsed wall-clock time and inference count.
What does `listing(Predicate)` display in Picat's interactive session?
Answer: The source clauses of the named predicate
`listing(Predicate)` prints all source clauses for the specified predicate to standard output.
Which flag setting causes Picat to throw an error when an undefined predicate is called?
Answer: unknown = error
Setting the `unknown` flag to `error` causes Picat to throw `existence_error` for undefined predicate calls.