Re: How to assert DCG clauses?
Wouter Beek <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <CAE1un7Mv06qwRMpHLek1Vgb6isBqu=zArz3kTRVUuBE30hDdhQ@mail.gmail.com> |
On Fri, Aug 30, 2013 at 10:33 AM, Carlo Capelli <[email protected]>wrote: > Hi Wouter > > ?- [user]. > :- dynamic b//3. > |: % user://2 compiled 0.01 sec, 1 clauses > true. > > ?- dcg_translate_rule(b(1,2,3)-->b,X),assert(X). > X = (b(1, 2, 3, _G2656, _G2657):-b(_G2656, _G2657)). > > could work for you ? > Yes that's it. Thanks Carlo! > > 2013/8/30 Wouter Beek <[email protected]> > >> Hi all, >> >> Clauses can be asserted: >> ~~~ >> ?- X =.. [':-',a,b], assert(X), listing(a). >> :- dynamic a/0. >> a :- >> b. >> X = (a:-b). >> ~~~ >> >> DCG clauses cannot be asserted in the same way: >> ~~~ >> X =.. ['-->', a, b], assert(X), listing(a). >> ERROR: toplevel: procedure `a' does not exist (DWIM could not correct >> goal) >> ~~~ >> >> How would one assert DCG clauses? >> >> --- >> Cheers!, >> Wouter. >> >> 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 >> > > -------------- next part -------------- HTML attachment scrubbed and removed