Ann Pack: debug_call 2.1

New version of pack debug_call (v2.1) available on the server.

The pack automates often used debug calls with emphasis on:
(a) avoiding calling things that will not be reported and
(b) easy tailoring of the messages.

For example the following code debugs info on the length of a list.

 ?- debug(ex).
 ?- debug_call(ex, length, math_vars/[x,y,z]).
 % Length for list, math_vars: 3

The length will only be calculated in debug mode- also, “length” unfolds to a relevant informative message.

debuc/n are shorthand for debug_call/1,2,3,4.

 ?- Mtx = [h(a,b,c),r(1,2,3),r(4,5,6),r(7,8,9)],
    debuc(ex, dims, mtx/Mtx).

 % Dimensions for matrix, mtx: nR: 4, nC: 3.

v2.1 introduces options to the calls, and through these a uniform way to add prefixes and caller predicate info

?- debuc(ex, enum, list_x/[x1,x1,x3], [pred(integral,2),prefix('At')] ).
 % At predicate: integral/2 starting enumeration of list: list_x
 % 1.x1
 % 2.x1
 % 3.x3
 % At predicate: integral/2 ended enumeration of list: list_x

debuc/4 is relaxed about Opts being a list as per many stoics.org packs.

 ?- debuc(ex, pwd, my_run, pred(bio_db,3) ).

 % Predicate: bio_db/3 pwd at, my_run, is: '/home/user/pl/packs/private/bio_db/proj273/'

Static documentation: html
Web page: debug_call
Github: github

Nicos Angelopoulos

2 Likes