I really never used explain/1, but now with the nicer messages and the recent addition of hyperlinks I find it quite useful:
If you have code like this:
some_widely_used_pred :- print(hi). another_pred :- some_widely_used_pred. yet_another_pred :- print(doing_something_else), some_widely_used_pred.
you can run:
1 ?- explain(some_widely_used_pred). % some_widely_used_pred is an atom % user:some_widely_used_pred/0 is a predicate defined in /tmp/t.pl:2 % Referenced from 1-th clause of user:another_pred/0 at /tmp/t.pl:5 % Referenced from 1-th clause of user:yet_another_pred/0 at /tmp/t.pl:8 true.
If you have hyperlinks enabled, in your terminal, you can click on
/tmp/t.pl:2 or any of the other references and it will open up in the editor. Quite useful also to see where a predicate is used from the toplevel, especially when you are planning to change
some_widely_used_pred and you want to see what will be affected. I like the new colors too!
I just added to some of my commonly used abbreviations in my init.pl file:
[...] z :- shell(bash). z(C) :- format(atom(C1), "sh -c '~w'",[C]), shell(C1). h(H) :- help(H). a(A) :- apropos(A). f(F,As) :- format(F,As). uml(Mod) :- use_module(library(Mod)). pp(A) :- print_term(A,[right_margin(90)]). ex(T) :- explain(T). [...]