You are very welcome. Best of luck and keep trying! ;-) - Jason On Sun, May 11, 2008 at 5:43 AM, katie678 <[EMAIL PROTECTED]> wrote:
> > This type of help is greatly appreciated and the response was so quick. > > I will follow all your instructions and see how I get on. > > Thanks so much > > Katie > > > Jason Morris wrote: > > > > On Sat, May 10, 2008 at 3:45 PM, katie678 <[EMAIL PROTECTED]> > > wrote: > > > >> > >> Hi, > >> > >> I am complety new to Jess and am in desperate need of help please. > > > > > > Hi Katie, > > > > Here is a list of issues that caught my eye: > > > > 1. If you have a function B that depends on function A, then function A > > *must* be defined in your Jess script *before* function B, else B will > not > > "know about" A. > > Look at your code carefully to spot this one. > > 2. All LHS patterns are implicitly joined with an (and). There is no > > need > > to use (and <pattern 1> <pattern 2> ... <pattern n> ) in your rules. Fix > > all the rules that do this. > > 3. Don't use the (or) connective to simply match facts having > alternative > > slot values. If you want to match on (foo) facts with a slot called > > "value" > > such that value = 5, 10, or 15 you would write: > > > > (defrule find-foos > > (foo (value ?v&5|10|25)) > > => > > ;; do something interesting here > > ) > > Fix all the rules where you have done this. > > > > 4. If you want a fact matched over a range of slot values, then you use > > predicate constraints like so: > > > > Match all (foo) fact with value between 1 and 3: > > (defrule find-foos-from-1-to-3 > > (foo (value ?v&:(>= ?v 1)&:(< ?v 4))) > > => > > ;; Do something interesting here > > ) > > Make these corrections, too. > > > > 5. When you have two or more rules for which there will never be more > > than > > one fact that activates more than one rule at a time, there is no need to > > enforce > > activation order using salience -- I think this is where your code > > diverges > > from the Tax Adviser example in "Jess in Action". The tax adviser will > > actually recommend multiple > > forms whereas you just recommend one course of action. When you do use > > salience, as in all programming, avoid using unbound "magic numbers" like > > 100000 and 70000. > > These are arbitrary and just bad karma -- the danger is where do you stop > > once you start? 100001, 100002, 70001, etc? > > Take a look at the article on the Jess wiki > > http://www.jessrules.com/jesswiki/view?SalienceUsageTips and in the > > documentation > > http://www.jessrules.com/jess/docs/71/rules.html#salienceregarding > > salience. > > > > Less important items... > > > > 1. You've got some typos in your questions that make answering them > > awkward. For example: > > "Do you want to work full time after homes?" makes no sense. > > "How many homes a week do you want to work?" -- clearly you meant > > "hours > > a week". > > Go through all your questions and edit them. > > > > 2. Good programmers error-trap their code for bad inputs. Any place > that > > you are expecting numerical input (asking about ages, dollars, etc.) run > > the > > input > > through the (numberp) function. (numberp) stands for number-parse, and > > gives back a boolean TRUE if its argument parses to any number. > > > > 3. Omit defining (defglobal ?*crlf* = ...) since it's part of Jess now > > anyway. Just use the symbol "crlf" anywhere you want a > > carriage-return-linefeed. > > > > It is important that you make these changes and that I just not give you > > my > > corrected solution -- I hope nobody actually does this! > > Once I fixed these issues, your program seemed to run just fine. > > > > I hope this helps! > > > > Cheers, > > Jason > > > > ----------------------------------------------------------- > > Jason Morris > > Morris Technical Solutions LLC > > [EMAIL PROTECTED] > > (517) 304-5883 > > > > > > -- > View this message in context: > http://www.nabble.com/Skipping-a-Rule---Help-needed-tp17166875p17170299.html > 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] > -------------------------------------------------------------------- > > -- ----------------------------------------------------------- Jason Morris Morris Technical Solutions LLC [EMAIL PROTECTED] (517) 304-5883
