Re: phrase/3 predicate
"Richard A. O'Keefe" <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
On 30/08/2013, at 9:26 AM, Josef Frydl wrote:
> Now, Rem is built and let say Rem ="123", if I say phrase(Rem, "1234", _) it does not succeeds , but if I paste the Rem value in it works
>
>
> ?- phrase("123", "1234", _).
> true.
OK.
>
> ?- A = "123",phrase(A,"1234",_).
> A = [49, 50, 51].
> ends there
What do you mean "ends there"? There is only one solution.
You are correctly shown the unique answer. There is no
other output you *should* get. And if the call to phrase/3
had not succeeded, you would not have been shown any value
for A.
Let me stress this: you said it does not succeed, but it *DOES*.
3 ?- A = "123", phrase(A, "5678", _).
false.
You are not having any problem whatsoever with phrase/3.
You appear to have misunderstood the Prolog top-level's
output, which was exactly what you *should* have expected
if everything was working perfectly. (Which it was.)
You are supposed to be able to take Prolog's response to a
top-level predicate and paste it into a file as the body of
a clause, which is why the command you type for "more answers
please" is ';' and why the final answer ends with '.'.