Well, you can't nest facts in this way, and neither can you usefully include function calls in deffacts. The right way to do this is just to use one or more assert statements; for example, you could do it all in one line like this:

(assert (couple (husband (assert (person (name John)(age 38))))
                (wife    (assert (person (name Marry)(age 36))))))



On Oct 29, 2008, at 5:02 AM, Nopphadol Chalortham wrote:

I would like to assert facts to the jess working memory by deffacts as below;
          This is my template's facts.

          (deftemplate person     (slot name)
          (slot age))
          (deftemplate couple     (slot husband (type object))
(slot wife (type object)))
So, I would like to insert two persons(john and marry)and a couple as below:
          (deffacts initfacts
          (person (name John)(age 38))
          (person (name Marry)(age 36))
          (couple       (hasband (person (name John)(age 38)) )
(wife  (person (name Marry)(age 36)) ))
)

But it has an error message: Undefined function person.
How can I solve this problem?

---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences, Sandia National Laboratories
PO Box 969, MS 9012, Livermore, CA 94550
http://www.jessrules.com







--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to