JESS: Checking list equality

2008-02-13 Thread Henrique Lopes Cardoso
Hi, I was trying to test equality for lists seen as sets (elements with any order). Is there any direct function, or any solution simpler than this: (bind ?list1 (list 1 2 3)) (bind ?list2 (list 3 2 1)) (and (= (length$ ?list1) (length$ ?list2)) (= (length$ (union$ ?list1 ?list2)) (length$

Re: JESS: Checking list equality

2008-02-13 Thread Szymon Klarman
Yes but this function won't do the job in general. Consider: list1 = (1 1 2), list2 = (2 2 3), (union$ list1 list2) = (1 2 3) Better to check whether intersection of the two lists have the same length as their union. all best, Szymon - Original Message - From: Wolfgang Laun [EMAIL

Re: JESS: Checking list equality

2008-02-13 Thread Wolfgang Laun
Given the precondition (as Henrique wrote) that the lists are sets you don't have to consider the general case. -W Szymon Klarman wrote: Yes but this function won't do the job in general. Consider: list1 = (1 1 2), list2 = (2 2 3), (union$ list1 list2) = (1 2 3) Better to check whether

Re: JESS: Checking list equality

2008-02-13 Thread Henrique Lopes Cardoso
Yes, I had noticed that. Thank you all. By the way, is it heavy to have such a test in a rule's LHS? Let me be more specific. I am trying to make a kind of refraction across multiple rules. The point is to prevent two rules from firing on the same facts. For this I use a special ordered fact

JESS: batch require

2008-02-13 Thread Skeptic 2000
Hi,I'm having a problem when I batch two different .clp files that require the same third .clp file. File1.clp Some defclasses File2.clp require file1Some rules using file1 defclasses File3.clp require file 1 Some other rules using file1 defclasses rete.batch(file2); rete.batch(file3);