I have a system where I need to ensure that for every member of a list,
there is a fact which contains that member.  For example, here's my domain:


(deftemplate source (slot id) (multislot templates))
(deftemplate transform (slot source) (slot template))


What I would like is to write some rules that ensure that for ever member of
the templates slot of a "source", I have a corresponding transform.  If I
assert:

(assert source (id 1) (templates (create$ a b c)))

I would like to see three facts asserted in response:

(assert transform (source 1) (template a))
(assert transform (source 1) (template b))
(assert transform (source 1) (template c))


I have accomplished this by creating an intermediary fact and some rules
which essentially cycle through the list of templates in the source,
asserting a transform for each.  However, this just feels wrong.  It seems
like I should be able to express this without the intermediary facts.

Perhaps this is where backward chaining would be useful?  Or perhaps I can
use the new "accumulate" CE?  Or, have I already found the solution using an
intermediary fact to cycle through the list of templates?

Any help/suggestions would be appreciated.



--------------------------------------------------------------------
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