I'm sorry, I sent this message before without the reply.

Kathy Lee,

You need the '(test <...>)' conditional element in order to call your
deffunction. So your code should look like this:

(defrule Organic-tonnage
    (tRec (CCC ?c))
    (test (eq (CCC1 ?c) "M"))
    (CCC3-is-B-or-C ?c)    ;; THIS LINE DOES NOT SEEM TO CALL MY
DEFUNCTION ABOVE

    (test (CCC3-is-B-or-C ?c))  ;; Replace the above line with this one.

    ;(test (or (eq (CCC3 ?c) "B") (eq (CCC3 ?c) "C")))
    =>
    (assert (itemCommodity "Organic Tonnage")))

Good luck.
-Hisham-


On Mon, 26 Oct 1998, Kathy Lee Simunich wrote:

> OK, I give up.  I think I might have gone insane.  I believe that the
> following
> code worked on Friday, but now I run it, and it does not work!  I'm
> trying
> to make a deffunction out of a test that I seem to be doing alot
> (ccc3-is-b-or-c)
> in a bunch of rules.  I've commented out the original test in the
> orgain-tonnage
> rule (that did work), and put it into a defunction.  The problem is that
> 
> after I (assert (tRec (CCC "M7C"))), the rule does not activate, because
> 
> it does not call the defunction.  It looks right to me, and like I said,
> I swear
> it worked on Friday.  I made the change to Funcall.java that Ernest sent
> out
> yesterday, but I didn't think that would make a difference... I did back
> out the
> change to see if it did affect something somehow, but nope, no
> difference.
> 
> I'm not that proficient in CLIPS, so it is slow going for me when trying
> to
> do more advanced things.  I could just repeat the test code in each
> rule,
> but I was hoping I understood the defunction stuff.
> 
> Anyway, a hint would be greatly appreciated.
> KathyLee Simunich
> Argonne National Lab
> 
> ----code included----
> 
> ; For stand-alone testing
> (deftemplate tRec
>     (slot CCC))
> 
> (deffunction CCC1(?c)
>     (sub-string 1 1 ?c))
> 
> (deffunction CCC3(?c)
>     (sub-string 3 3 ?c))
> 
> (deffunction CCC3-is-B-or-C(?c)
>     (or (eq (CCC3 ?c) "B") (eq (CCC3 ?c) "C")))
> ;;-----------
> 
> (defrule Organic-tonnage
>     (tRec (CCC ?c))
>     (test (eq (CCC1 ?c) "M"))
>     (CCC3-is-B-or-C ?c)    ;; THIS LINE DOES NOT SEEM TO CALL MY
> DEFUNCTION ABOVE
> 
>     ;(test (or (eq (CCC3 ?c) "B") (eq (CCC3 ?c) "C")))
>     =>
>     (assert (itemCommodity "Organic Tonnage")))
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the
> list. List problems? Notify [EMAIL PROTECTED]
> ---------------------------------------------------------------------
> 
> 

--------------------------
Dr. Hisham Assal
CAD Research Center
Cal Poly State University
San Luis Obispo, CA 93407
Tel. (805) 756 2673
Fax. (805) 756 7567
http://www.calpoly.edu/~hassal

---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list. List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------

Reply via email to