I would do that. But the problem is I want to test if [there exists a fact
of the form (available-part (name X)) for all X inside the list].
That's why the solution you offered would not work, since I just want to
test instead of adding new facts.

Thanks for your response and I hope I could express myself clearer this
time.

Best regards,

Levent





On Tue, Jul 28, 2009 at 4:27 PM, Nick Tinnemeier <n...@cs.uu.nl> wrote:

> Dear Levent,
>
> You are using a function (foreach) at the LHS of a rule. See
> http://www.jessrules.com/FAQ.shtml#Q17 for an explanation on why this is
> not good practice.
> Try putting the foreach loop on the RHS of the rule, and most likely things
> will work as expected.
>
> (defrule BuildPlanForward
>   (depends-on (parent ?a) (children ?list))
>   =>
>   (foreach ?c ?list (assert (available-part (name ?a))))
>
> - Nick.
>
>
> levent kent wrote:
>
>  Hi  everybody,
>>
>> I am doing my masters thesis and have a problem with lists.
>> It is actually very simple.
>>
>> I want to create a rule which says:
>> If all subtasks of a parent task are completed, then the parent task can
>> be completed too.
>>
>> I tried the code below, but it seems that I can not use "foreach" at LHS
>> of a rule.
>>
>> (defrule BuildPlanForward
>>    (depends-on (parent ?a) (children ?list))
>>    (foreach ?c ?list  (available-part (name ?c)))
>>    =>
>>    (assert (available-part (name ?a)))
>>    )
>>
>> How could I write such a rule in Jess?
>>
>> Thanks,
>>
>> --
>> Levent Kent
>>
>
>
>
>
> --------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users y...@address.com'
> in the BODY of a message to majord...@sandia.gov, NOT to the list
> (use your own address!) List problems? Notify owner-jess-us...@sandia.gov.
> --------------------------------------------------------------------
>
>


-- 
Levent Kent

Reply via email to