I think Jon Weygandt wrote: > it looks like modifying a fact sometimes requires the equivalent of: > > For each slot modified > { > Retract the fact > Set the slot > Assert the fact > }
Yes, more or less. Special versions of "retract" and "assert" can be used to cut a few corners in this specific case, but that's just how the Rete algorithm works. Same way re-hashing a hash table works, too, if you think about it, more or less. > > Although in 6.1p7 it appears that from the rules modify accepts multiple > slot/values and is optimized (whereas Rete offers only a single > slot/value at a time) and 7.0b3 seems to do the inefficient loop. > Jess 6 and earlier would retract the fact, modify all the slots, then assert. The current version of Jess 7 will do the whole cycle for each modified slot. The reason for this is that the slot-specific activation features need to know the slot that's been modified when the assert is done. There are two ways to accomplish this: either provide a collection of slot names and allow multiple simultaneous modifies, or change things to really only modify one slot at a time, and then pass around just the one slot name. I've gone back and forth on which is better. Obviously it depends on how frequently a program uses the multiple-modify syntax. If it's used infrequently, then forcing the Rete network to iterate over all those one-item collections is inefficient. If multiple-modify is used a lot, then it's a net gain to pass the collections around. My impression is that multiple modify -- i.e., (modify ?fact (slot-1 X) (slot-2 Y) (slot-3 Z)) is used infrequently. I'd be interested to hear otherwise, though! --------------------------------------------------------- Ernest Friedman-Hill Advanced Software Research Phone: (925) 294-2154 Sandia National Labs FAX: (925) 294-2234 PO Box 969, MS 9012 [EMAIL PROTECTED] Livermore, CA 94550 http://herzberg.ca.sandia.gov -------------------------------------------------------------------- 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] --------------------------------------------------------------------