Hi Doug,

> What's the best way to trace pilog?

Pilog clauses can indeed be traced.

Unfortunately, I don't find a good description at the moment. The
reference of '?' (and of 'prove' which is the internal machinery of the
query front end '?') just briefly mentions it:


It works by simply passing the names of the clauses you want to trace
right after the '?' (i.e. the ['sym' ..] arguments).

A simple example, using the 'append' clause:

Without tracing

   : (? (append (a b c) @X (a b c d e f)))
    @X=(d e f)
   -> NIL

With tracing

   : (? append (append (a b c) @X (a b c d e f)))
   2 (append (a b c) @Y (a b c d e f))
   2 (append (b c) @Y (b c d e f))
   2 (append (c) @Y (c d e f))
   1 (append NIL (d e f) (d e f))
    @X=(d e f)

The trace output lists all clauses that _matched_, and always starts
with a number indicating _which_ of the clauses in the definition

The definition of 'append' is

   : (rules 'append)
   1 (be append (NIL @X @X))
   2 (be append ((@A . @X) @Y (@A . @Z)) (append @X @Y @Z))
   -> append

The symbolic arguments to '?' can of course also specify clauses
somewhere deeply nested in the Pilog definitions, not just those passed
to '?' on the top level.

- Alex
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to