Re: Disjunction in phrase/[2,3]

Jan Wielemaker <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
On 07/28/2013 10:29 AM, Wouter Beek wrote:
> Hi all,
> 
> I get the following warning for the use of disjunction in meta-DCG rules:
> ~~~
> Warning: The predicates below are not defined. If these are defined
> Warning: at runtime using assert/1, use :- dynamic Name/Arity.
> Warning:
> Warning: test:;/4, which is referenced by
> Warning:        c:/prolog/webqr/test.pl:6:5: 1-st clause of test:a/2
> ~~~
> 
> Am I doing something wrong or is the missing predicates check too
> restrictive?
> 
> Sample code:
> ~~~{.pl}
> a -->  x((b ; c)).
> b --> [98].
> c --> [99].
> :- meta_predicate(x(2,?,?)).

Works with this declaration.  DCG bodies are are bit more complicated
than just '2', so you must tell the system.

:- meta_predicate(x(//,?,?)).

	Cheers --- Jan

> x(DCG, A, B):- phrase(DCG, A, B).
> ~~~
> 
> ---
> Cheers,
> Wouter Beek.
> 
> E-mail: [email protected]
> WWW: www.wouterbeek.com
> Tel.: 0647674624
> -------------- next part --------------
> HTML attachment scrubbed and removed
> _______________________________________________
> SWI-Prolog mailing list
> [email protected]
> https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-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.