4.40 Debugging and declaring determinism
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • Built-in Predicates
        • Debugging and declaring determinism
          • det/1
          • $/0
          • $/1
    • Packages
Availability:built-in
Source[experimental]$(:Goal)
Verify that Goal succeeds deterministically. This predicate has no effect if Goal succeeds without a choicepoint. Otherwise the result depends on the Prolog flag determinism_error:
silent
Act as once/1.
warning
Print a warning and act as once/1.
error
Raise a determinism_error exception.

Note that if $/1 is used for the last call, last call optimization is not effective. This behaviour ensures consistent errors or warnings. Last call optimization with determinism checking can be realised using ..., $, Last., i.e. by executing $/0 before the last call rather than wrapping the last call in $/1.

Violations throw an error/2 exception determinism_error(Pred, Declared, Observed, goal).