Re: Cyclical definition
Daniel Lyons <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
On Jan 6, 2014, at 12:09 AM, Anne Ogborn <[email protected]> wrote: > This question came up on ##prolog > > from a freshly started SWI-Prolog > > 1 ?- father(X) = X. > X = father(X). > > 2 ?- > > I'm not sure what SWI-Prolog should do in this case? > > Defining father(7) seems to have no effect. > > the original poster said > > ] <Gal3rielol> Hi, in the new swipl, when I try father(X)=X, it gives me the answer X = father(X). But in the book LPN, it says that the answer should be like X = father(father(father(father(father(father(...)))))))))). SWI 6.2.2 has the odd behavior as well. GNU Prolog 1.4, on the other hand, does more-or-less what you expect: | ?- X = father(X). cannot display cyclic term for X yes > I am baffled and feel fear in my heart, for Prolog eludes again. I’m glad I’m not the only one that happens to. — Daniel Lyons