How to solve a problem with an infinite loop [beginners question]
- From: philipp.strack@xxxxxxxxx
- Date: Sat, 06 Oct 2007 21:35:59 -0000
Hi everybody,
I have the following grammar
gleich(a,b).
gleich(b,c).
gleich(A,B) :-
A=B.
gleich(A,B) :-
gleich(B,A).
gleich(A,B) :-
gleich(A,X),gleich(X,B).
I want to ask prolog the following questions (which should all lead to
the answer true):
gleich(a,a).
gleich(a,b).
gleich(b,a).
gleich(a,c).
gleich(c,a).
gleich(a,c) and gleich(c,a) leads to an infinity loop how can I avoid
this?
best wishes
Philipp
.
- Follow-Ups:
- Re: How to solve a problem with an infinite loop [beginners question]
- From: Neng-Fa Zhou
- Re: How to solve a problem with an infinite loop [beginners question]
- From: Chip Eastham
- Re: How to solve a problem with an infinite loop [beginners question]
- From: pineapple . link
- Re: How to solve a problem with an infinite loop [beginners question]
- Prev by Date: Re: Converting Scheme to Prolog
- Next by Date: Re: Converting Scheme to Prolog
- Previous by thread: swi prolog + clpr question
- Next by thread: Re: How to solve a problem with an infinite loop [beginners question]
- Index(es):
Relevant Pages
|
|