DCG question: bind to inputs.

emacstheviking <[email protected]>
Newsgroups gmane.comp.gnu.prolog.general
Message-ID <CAEiEuU+1mq2S=_+qUhaXaY680z3gSb-G7y2hoB2HgHGsF0ZosQ@mail.gmail.com>
Hi,

After reading the manual (section 7.17.1 again) I am still confused... If I
have this DCG rule:

foo(X) --> bar(X)

I know it expands to:

foo(X,A,B) :- bar(X, A, B).

How do I add a format statement like this:

foo(X) --> bar(X), {format("bar(X) ok, X is ~w~n", [???])}.

How do I bind to those two input arguments that are the source list and the
resulting output list so I can do things with them / to them ? Sure I can
print out X because that is in scope as it were but how to get A and B ?? I
know this is a simple question and even worse I know I think I already know
the answer, I just don't know I know yet.

Thanks,
Sean.

_______________________________________________
Users-prolog mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/users-prolog
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.