Your definition of `ancestor` is one or two steps of parentage: > ancestor(A, B) :- parent(A, B). > ancestor(A, B) :- parent(A, C), parent(C, B).
I suspect you want one of those lines to appeal to the `ancestor` relation to allow longer chains. - Sam Caldwell On Wed, Jan 31, 2018 at 1:53 PM, Kevin Forchione <[email protected]> wrote: > Walking through the datalog tutorial I got the following transcript: > > Welcome to DrRacket, version 6.12 [3m]. > Language: datalog, with debugging; memory limit: 512 MB. > > parent(john, douglas). > > parent(john, douglas)? > parent(john, douglas). > > parent(john, evlyn)? > > > parent(bob, john). > > parent(A, B)? > parent(john, douglas). > parent(bob, john). > > parent(ebbon, bob). > > parent(john, B)? > parent(john, douglas). > > parent(A, A)? > > > ancestor(A, B) :- parent(A, B). > > ancestor(A, B) :- > parent(A, C), > parent(C, B). > > ancestor(A, B)? > ancestor(ebbon, bob). > ancestor(bob, john). > ancestor(john, douglas). > ancestor(bob, douglas). > ancestor(ebbon, john). > > > > It seems that the correct answer should also include ancestor(ebbon, > douglas). Am I doing something wrong? > > -Kevin > > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

