Re: Problem with phrase/3: help examples not working

Anne Ogborn <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
Francisco,

The error message is trying to be helpful.

> *ERROR: phrase/3: Undefined procedure: integer/3*
> *ERROR:   However, there are definitions for:*
> *ERROR:         integer/1*


The first argument of phrase/3 is expected to be a term. Two arguments
are added to the term, and that is called.

foo(X) -->  ... some code ....

generates foo/3, not foo/1

integer/1 is defined in the built in predicates of SWI-Prolog. Unless you've
explicitly loaded dcg_basics or defined it yourself, there is no integer/3

So when you call

 phrase(integer(X), "42 times", Rest).


it looks for integer/3 and can't find it. The error messages use the power of SWI-Prolog
to be a little smart and suggest maybe you're looking for the arity 1 version.
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.