I think Duane Morin wrote:
>
> Howdy all,
>
> If what I'm doing is committing any CLIPS sins, somebody please let me know -
> I'm a Lisp guy :).
>
> I've written a member function that's more specific to my needs. I call it
> oneOfMember, and it takes two lists - one a 'bag' of stuff to look for, and
> the second a list in which to look. The function returns the matched item.
> So:
> (oneOfMember (create$ A B C) (create$ (D E B Q)))
>
> would return B.
This is basically the intersection$ function, isn't it?
>
> But, after I've got a match, I need to assert a fact that contains the item
> that was matched. (If more explanation is needed, I've got a sentence and a
> list of dictionary terms. If one is found, I want to assert which one was
> found. And I don't want to make a rule for every term.)
>
> So, I need to do something like this:
> (bind ?d (oneOfMember (create$ A B C) (create$ (D E B Q))))
> (assert (match (concept DICTIONARY-TERM) (data ?d)))
>
> Well, since I only want to fire this rule on a match, I need that oneOfMember
> statement to be in front of the =>. Which means I need it in a (test...),
> right?
>
> So hence, my question - can I somehow test it and bind it at the same
> time? Can I do this:
> (bind ?d (oneOfMember (create$ A B C) (create$ (D E B Q))))
> (test ?d)
> =>
> (assert (match (concept DICTIONARY-TERM) (data ?d)))
I understand what you're asking, but this isn't possible in Jess (or
in CLIPS). There's no 'execution context' that's carried over from
rule LHS to RHSs except for the list of matched facts, so there's no
place to put this variable.
Anyway, doing the test on the RHS of the rule should be no more nor
less efficient than on the LHS, unless the proposed test is not the
last CE in the rule. If you want to do this in the middle of a complex
rule, it would be better to break it into two rules.
>
> Thanks!
>
> Duane
>
>
---------------------------------------------------------
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]
---------------------------------------------------------------------