Assuming that there's some definite ordering among your instances, you just need to make those explicit somehow -- give each instance a slot holding a serial number -- and then you can identify "the next two" and "the last two" by comparing those numbers. Otherwise it's the same as comparing any two facts.
If they're Java objects, you can generate the IDs in Java using a static member variable. if they're Jess facts, you could use the (default-dynamic) slot property to automatically create a value when the fact is asserted. ________________________________ From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of nikos erinis Sent: Wednesday, October 19, 2011 7:14 AM To: jess-users Subject: JESS: compare slots but only with the last two instances hi fellows, it's me again :) i wrote to you about a week ago. i wanted to compare slots but i didnt get any answers. i realised the question was very "dumm". i foun the solution on my own. but now i have a bigger problem. i just want to compare the slot of an instance but only with the last two instances and the next two instances... is this possible!? thank you for your time !