object matching with multislots

Anonymous
2009-05-03
2012-11-23
  • Anonymous - 2009-05-03

    (defclass Man (is-a USER)
      (multislot friends))

    (defrule rule1
       (object (is-a Man) (friends ?f))
       =>
       (printout t "We have a friend." crlf))

    (make-instance jack of Man (friends create$ pete))  matches

    BUT

    (make-instance jack of Man (friends create$ pete sue)) does NOT match

    What am I doing wrong?

     
    • Gary Riley

      Gary Riley - 2009-05-03

      Your pattern matches a Man having exactly one friend. You want to use either (friends ?f $?) or (friends ? $?) and your make-instance call can be simplified to (make-instance jack of Man (friends pete sue)).

       
    • Anonymous - 2009-05-04

      Thanks Gary I really appreciate how you take time to answer questions. I think clips is fantastic.

       

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks