[plt-scheme] Re: plt-scheme Digest, Vol 5, Issue 14

From: geb a (geb_a at yahoo.com)
Date: Fri Jan 6 11:40:57 EST 2006

Since we have been discussing Schelog/prolog, I have a
few questions myself.  I am having some trouble
understanding the structure of Schelog programs.

Say I have the following program...

(define %likes
  (%rel ()
        (('mary 'food))
        (('mary 'wine))
        (('mary 'cats))
        (('john 'mary))
        (('john 'wine))


(which(stuff ) (%likes 'john stuff)) => (stuff 'mary)
(%more) => (stuff 'wine)
(%more) => #f

; likes(mary,X)
(which (stuff) (%likes 'mary stuff)) => (stuff 'food)

; likes(Y,food).
(which (person) (%likes person 'food)) => (person

; likes(Y,wine)
(which (person) (%likes person 'wine)) => (person

This is where I have troubles... How do you add a rule
that John likes anything that Mary likes.  At this
point Schelog seems to lock up because the rule is

;John likes anything that Mary likes
(%assert %likes ()
  [('john (which (stuff) (%likes 'mary stuff)))])

What would the proper way to do this?

Thanks for the help!

Dan Anderson

Yahoo! DSL – Something to write home about. 
Just $16.99/mo. or less. 

Posted on the users mailing list.