Hi Christophe,

> > Yes. This is an infinite recursion.
> ...
> So it seems it's not a syntax problem, but a conceptual one. I thought
> about @x and @y being the same person, but it shouldn't.
> Another hint?

I'm not a Prolog expert, but fact is that if the first three clauses

   (be bigger (me her))
   (be bigger (her son))
   (be bigger (son daughter))

don't find a match, the fourth one

   (be bigger (@x @y) (bigger @x @z) (bigger @z @y))

will always match and recurse infinitely.


I suspect this can be solved with a 'cut' (anybody out there who
knows?), but another solution would be to separate it into two
predicates:

   (be isbigger (me her))
   (be isbigger (her son))
   (be isbigger (son daughter))

   (be bigger (@x @y) (isbigger @x @y))
   (be bigger (@x @y) (isbigger @x @z) (isbigger @z @y))

This gives:

   : (? (bigger son daughter))
   -> T

   : (? (bigger me @A))
    @A=her                   
    @A=son
   -> NIL

   : (? (bigger @A @B))
    @A=me @B=her                   
    @A=her @B=son
    @A=son @B=daughter
    @A=me @B=son
    @A=her @B=daughter
   -> NIL

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to