{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Jess71p2 37 - in this regard Jess includes the deffacts...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
5. Working Memory 29 Note that an ordered fact is very similar to an unordered fact with only one multislot. The similarity is so strong, that in fact this is how ordered facts are implemented in Jess. If you assert an ordered fact, Jess automatically generates a template for it. This generated template will contain a single slot named "__data". Jess treats these facts specially - the name of the slot is normally hidden when the facts are displayed. This is really just a syntactic shorthand, though; ordered facts really are just unordered facts with a single multislot named "__data". 5.5. The deffacts construct Typing separate assert commands for each of many facts is rather tedious. To make life easier
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: in this regard, Jess includes the deffacts construct. A deffacts construct is a simply a named list of facts. The facts in all defined deffacts are asserted into the working memory whenever a reset command is issued: Jess> (deffacts my-facts "Some useless facts" (foo bar) (bar foo)) TRUE Jess> (reset) TRUE Jess> (facts) f-0 (MAIN::initial-fact) f-1 (MAIN::foo bar) f-2 (MAIN::bar foo) For a total of 3 facts in module MAIN. 5.6. How Facts are Implemented Every fact, shadow or otherwise, corresponds to a single instance of the jess.Fact class. You can learn more about this class here. Templates are represented by instances of jess.Deftemplate , which you can read about here....
View Full Document

{[ snackBarMessage ]}