Hi,
You can't do this because (despite how it looks) the LHS of a rule
doesn't have an 'execution context' - no information is carried along
from CE to CE during processing. This more or less has to be the case,
since remember, rules with similar LHSs can share CE's - that's part
of what makes Rete fast.
To get the efficiency you want, you could write a function
'equal-to-one-of' (I guess the lisp 'mapcar' could be handy here!)
(deffunction equal-to-one-of (?f $?a)
(foreach ?i $?a
(if (eq ?i ?f) then (return TRUE)))
(return FALSE))
then just use (test (equal-to-one-of (CCC1 ?c) "E" "K" "L" "D")) .
> Thank you for the responses! The test trick worked. I thought I
> tried that, but with all the changes/testing I was doing, I probably
> messed something up.
>
> Now, can you tell me why I cannot use bind on the LHS? How can I set
> a variable to be used in another CE? In the following, I just want to
> set ?c1 to the first character in CCC, and use it in the following CE,
> instead of having to repeat the CCC1 function for each equality test.
>
> ---- code snippet---
> (deffunction CCC1(?c)
> "return the first character from the cargo category code" (sub-string
> 1 1 ?c))
>
> (defrule Hazardous-containerized
> (tRec (CCC ?c))
> (bind ?c1 =(CCC1 ?c))
> (test (or (eq ?c1 "D") (eq ?c1 "E") (eq ?c1 "K") (eq ?c1 "L"))) =>
> (printout t "c1= " ?c1)
> (assert (itemCommodity "Hazardous Not Containerized")))
>
> ---end---
>
> This forum is great - without alot of examples to look at, I need the
> help! Thanks,
KathyLee Simunich
Argonne National Lab
---------------------------------------------------------
Ernest Friedman-Hill
Distributed Systems Research Phone: (510) 294-2154
Sandia National Labs FAX: (510) 294-2234
Org. 8920, MS 9214 [EMAIL PROTECTED]
PO Box 969 http://herzberg.ca.sandia.gov
Livermore, CA 94550
---------------------------------------------------------------------
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]
---------------------------------------------------------------------