[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Binding a variable to the "output" of a predicate
From: |
Andy Schmidgall |
Subject: |
Binding a variable to the "output" of a predicate |
Date: |
Thu, 24 Oct 2002 23:42:56 -0500 |
Hello,
I'm attempting to translate some prolog code fragments from a different
version of prolog into gprolog, and I was wondering if it's possible to bind
a variable to the "output" of a predicate. I suppose it would be like
redirecting the output to a variable rather than standard out.
For example, say there's a predicate like this:
write_output(X):-
write(X).
Normally, this would write to the screen, but I'm wondering if there's a way
to get the results into a variable. The code fragment I'm translating from
used a construct like this:
write_output(X) ~> Y
(The operator is tilde-greater-than)
Thank you,
Andy
"You have heard that it was said, 'Do not commit adultery.' But I tell you
that anyone who looks at a woman lustfully has already committed adultery
with her in his heart." - Matthew 5:27-28
- Binding a variable to the "output" of a predicate,
Andy Schmidgall <=