Makes sense, indeed. Thank you. - Szymon
Ernest Friedman-Hill wrote: > > Two things to understand: > > 1) Jess's working memory can't contain duplicate facts. If you modify > a fact and it becomes identical to another fact, then the modified > fact object is effectively removed from working memory. You can think > of it as "merging" with the pre-existing fact that it is now > identical to. > > 2) When you call modify, Jess takes the fact you pass in and > (quickly) finds one in working memory that is equal to the argument, > then modifies that found fact. That way you don't have to have a > reference to an actual working memory element to modify the "real" > element. > > So here, ?m is bound to the fact object with id 61. When you modify > that fact, it becomes equal to the fact with id 62, and so fact 61 is > dropped from working memory. ?m is still bound to the jess.Fact > object, but that object is no longer in working memory. Then when you > call modify on ??m again, Jess finds fact 62, which is equal to fact ? > m but is in working memory, and modifies that fact. > > Make sense? > > If the double-modified fact would not be equal to fact 62, then don't > call modify twice -- just call it once, with both slot specifiers at > the same time. It will not only do the right thing, but it will be > more efficient, too: > > (modify ?m (tb-added ?ta1 ?ta2) (literals ?add ?lit)) > > -- View this message in context: http://www.nabble.com/Jess-confuses-Fact-id-assigned-to-a-variable-%28%21-%21%29-tf4884619.html#a13989267 Sent from the Jess mailing list archive at Nabble.com. -------------------------------------------------------------------- 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] --------------------------------------------------------------------
