<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7654.12">
<TITLE>IRC: interesting topic: use of lists using &quot;from&quot; in LHS and iterated over in RHS</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->

<P><FONT SIZE=2 FACE="Arial">HI,</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">There was an interesting discussion today on IRC; a user &quot;jochen&quot; reported NPEs when trying to iterate lists in the RHS constructed in the LHS using &quot;from collect&quot;.</FONT></P>

<P><FONT SIZE=2 FACE="Arial">I was wondering how Drools handles lists constructed in the LHS; if the list contained 5 elements but another rule retracted one of those elements would the list available in the RHS contain 4 or 5 elements?</FONT></P>

<P><FONT SIZE=2 FACE="Arial">Here's a simplification of what was posted at </FONT><A HREF="http://pastebin.com/yKGSxFkA"><U><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">http://pastebin.com/yKGSxFkA</FONT></U></A>
</P>

<P><FONT SIZE=2 FACE="Arial">Rule 1</FONT>

<BR><FONT SIZE=2 FACE="Arial">when</FONT>

<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">$cheese : ArrayList() from collect(CheeseFact());</FONT>

<BR><FONT SIZE=2 FACE="Arial">then</FONT>

<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">for(int i=0; i&lt;$cheese.size(); i++) {</FONT>

<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">//Something useful&#8230;</FONT>

<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">}</FONT>

<BR><FONT SIZE=2 FACE="Arial">end</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">What if there was another rule that did something like this:-</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">Rule 2</FONT>

<BR><FONT SIZE=2 FACE="Arial">When </FONT>

<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">$cf : CheeseFact(type == &quot;chedder&quot;)</FONT>

<BR><FONT SIZE=2 FACE="Arial">Then</FONT>

<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">retract($cf);</FONT>

<BR><FONT SIZE=2 FACE="Arial">end</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">What would be the list Rule 1 iterates?</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">I'd assume since I believe activation execution to be serial it would depend on the agenda's conflict resolution strategy or rule salience?</FONT></P>

<P><FONT SIZE=2 FACE="Arial">What would be the learned opinion?</FONT>
</P>

<P><FONT COLOR="#000000" SIZE=2 FACE="Arial">With kind regards,</FONT>
</P>

<P><FONT COLOR="#000000" SIZE=2 FACE="Arial">Mike</FONT>
</P>

</BODY>
</HTML>