@@ -378,6 +378,8 @@ The modules that ship with Scryer Prolog are also called
|
|||||||
write `integer_si(X)` to ensure soundness of your programs.
|
write `integer_si(X)` to ensure soundness of your programs.
|
||||||
"si" stands for *sufficiently instantiated*, and also for
|
"si" stands for *sufficiently instantiated*, and also for
|
||||||
*sound inference*.
|
*sound inference*.
|
||||||
|
* [`debug`](src/lib/debug.pl)
|
||||||
|
Various predicates that allow for declarative debugging.
|
||||||
* [`pio`](src/lib/pio.pl)
|
* [`pio`](src/lib/pio.pl)
|
||||||
`phrase_from_file/2` applies a DCG nonterminal to the contents of a
|
`phrase_from_file/2` applies a DCG nonterminal to the contents of a
|
||||||
file, reading lazily only as much as is needed. Due to the compact
|
file, reading lazily only as much as is needed. Due to the compact
|
||||||
|
|||||||
22
src/lib/debug.pl
Normal file
22
src/lib/debug.pl
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
% Source: https://stackoverflow.com/a/30791637
|
||||||
|
|
||||||
|
:- module(debug, [
|
||||||
|
op(900, fx, $),
|
||||||
|
op(900, fx, $-),
|
||||||
|
op(950, fy, *),
|
||||||
|
(*)/1,
|
||||||
|
($)/1,
|
||||||
|
($-)/1
|
||||||
|
]).
|
||||||
|
|
||||||
|
:- use_module(library(format), [portray_clause/1]).
|
||||||
|
|
||||||
|
$-(G_0) :-
|
||||||
|
catch(G_0, Ex, ( portray_clause(exception:Ex:G_0), throw(Ex) ) ).
|
||||||
|
|
||||||
|
$(G_0) :-
|
||||||
|
portray_clause(call:G_0),
|
||||||
|
$-G_0,
|
||||||
|
portray_clause(exit:G_0).
|
||||||
|
|
||||||
|
*(_).
|
||||||
Reference in New Issue
Block a user