2007年4月14日 星期六

Jess Note

Reference: Jess document
  • salience: use to define the priority of rules, higher value have higher priority.
    Jess> (defrule example-6
    (declare (salience -100))
    (command exit-when-idle)
    =>
    (printout t "exiting..." crlf))
  • the following code can match expressions with one pair parenthesis.
    ?f <- (expr $?front "(" $?middle ")" $?end)
    $?front can match the string until reach the first "(" $?middle can match the string until reach the first ")" so does $?end.
  • clear: clear working memory. The working memory will be empty.
  • reset: reset working memory and insert all facts in deffacts.
  • batch hw2.clp: execute the Jess file named hw2.clp
  • all command must be enclosed with parenthesis