Hi Sidney,
Sorry to tell you this, but both of these Aren't My Fault (TM).
The first deffunction has mismatched parentheses - Emacs (can't live
without it!) tells me that the paren right before the last ?result
matches the one before 'deffunction.' I think one of the four in a row
closing the first 'while' is the extra one, judging by the indentation.
Jess 4.0 might have silently discarded the extra stuff, as CLIPS can
do sometimes (try it and see!)
c:/users/root/Jess41b6> clips
CLIPS (V6.0 05/12/93)
CLIPS> (printout t foo crlf) bar)
foo
CLIPS>
Jess 4.1 is doing a nobler thing, I think, by reporting the error.
In the second rule, it might have been the case that Jess parsed it,
but if so, it was unintended (I'm actually surprised to hear that
this ever worked; maybe it parsed, but didn't work the way you
expected.) You must use '&' to string together multiple constraints in
patterns; ?x&:(> ?x 10), not ?x:(> ?x 10).
CLIPS> (defrule foo (bar ?x:(> ?x 10)) => )
[PRNTUTIL2] Syntax Error: Check appropriate syntax for defrule.
ERROR:
(defrule MAIN::foo
(bar ?x: (
CLIPS> (defrule foo (bar ?x&:(> ?x 10)) => )
CLIPS>
I think [EMAIL PROTECTED] wrote:
>
> I'm only just making the move from 4.0 to 4.1 so I don't know where
> this crept in, but the following parse fine in 4.0. I hope the solution
> (on either my end or Jess's) is simple, because I have a lot of these,
> and life in 4.0 finally became difficult enough for me to make the leap,
> so I'd rather not go back!!
>
> --Sidney Bailin
>
>
>
> (deffunction extract-pegs
> (?string)
> (bind ?pegs (create$))
> (if (pegged-p ?string)
> then
> (bind ?tail (sub-stringX (+ (str-indexX "?=" ?string) 2)
> (str-lengthX ?string)
> ?string)
> )
> (while (pegged-p ?tail) do
> (bind ?next-peg (sub-stringX 1
> (- (str-indexX "?=" ?tail) 1)
> ?tail
> ))
> (if (not (eq (sub-stringX 1 1 ?next-peg) "?"))
> then (bind ?next-peg (str-cat "?" ?next-peg))
> )
> (bind ?pegs (create$ ?pegs ?next-peg))
> (bind ?tail (str-cat (sub-stringX (+ (str-indexX "?=" ?tail) 2)
> (str-lengthX ?tail)
> ?tail
> )))
^^^ ---- I think one of these isthe extra one.
)
>
> (if (> (str-lengthX ?tail) 0)
> then
> (if (not (eq (sub-stringX 1 1 ?tail) "?"))
> then
> (bind ?tail (str-cat "?" ?tail))
> )
> (bind $?result (create$ ?pegs ?tail))
> else
> (bind ?result ?pegs)
> )
> else
> (bind ?result ?pegs))
> )
> ?result
> )
>
> Rete Exception in routine JessToken::tokenToValue.
> Message: Unbound variable: result at line 334: ?result .
> at jess.JessToken.tokenToValue(JessToken.java:39)
> at jess.Jesp.parseSexp(Jesp.java:125)
> at jess.Jesp.parse(Jesp.java:59)
> at jess.Rete.executeCommand(Rete.java:1116)
> at com.kevol.fam.rulebase.RuleLoadUtil.loadRuleFile(RuleLoadUtil.java:99)
> at com.kevol.fam.rulebase.RuleLoad.loadCoreRules(RuleLoad.java:165)
> at com.kevol.fam.rulebase.RuleLoad.<init>(RuleLoad.java:77)
> at com.kevol.fam.Fam.main(Fam.java:195)
>
>
> (defrule retract-concept-justified-by-obsolete-negation-2
> (declare (salience 98))
> (assert-this diagram-fact ?bad-fact ?diagram ?concept
> ?arg1-name ?arg1-id ?arg2-name ?arg2-id)
> (negative-justif-2 ?tag diagram-fact ?bad-fact
> ?d:(or (eq ?d ?diagram) (eq ?d .))
> ?c:(or (eq ?c ?concept) (eq ?c .))
> ?a1:(or (eq ?a1 ?arg1-name) (eq ?a1 .))
> ?i1:(or (eq ?i1 ?arg1-id) (eq ?a1 .))
> ?a2:(or (eq ?a2 ?arg2-name) (eq ?a2 .))
> ?i2:(or (eq ?i2 ?arg2-id) (eq ?i2 .)))
> (justified ?tag diagram-fact $?fact)
> ?fact-addr <- (diagram-fact $?fact)
> =>
> (assert (retract-this diagram-fact ?fact))
> (assert (retract-justifications-too ?fact-addr))
> )
>
> Rete Exception in routine Jesp::parsePattern.
> Message: Bad slot value at line 538: ( defrule
>retract-concept-justified-by-obsolete-negation-2 ( declare ( salience 98 ) ) (
>assert-this diagram-fact ?bad-fact ?diagram ?concept ?arg1-name ?arg1-id ?arg2-name
>?arg2-id ) ( negative-justif-2 ?tag diagram-fact ?bad-fact ?d: ( .
> at jess.Jesp.parseError(Jesp.java:1481)
> at jess.Jesp.parsePattern(Jesp.java:1337)
> at jess.Jesp.doParseDefrule(Jesp.java:982)
> at jess.Jesp.parseDefrule(Jesp.java:867)
> at jess.Jesp.parseSexp(Jesp.java:142)
> at jess.Jesp.parse(Jesp.java:59)
> at jess.Rete.executeCommand(Rete.java:1116)
> at com.kevol.fam.rulebase.RuleLoadUtil.loadRuleFile(RuleLoadUtil.java:99)
> at com.kevol.fam.rulebase.RuleLoad.loadCoreRules(RuleLoad.java:165)
> at com.kevol.fam.rulebase.RuleLoad.<init>(RuleLoad.java:77)
> at com.kevol.fam.Fam.main(Fam.java:195)
>
---------------------------------------------------------
Ernest Friedman-Hill
Distributed Systems Research Phone: (510) 294-2154
Sandia National Labs FAX: (510) 294-2234
Org. 8920, MS 9214 [EMAIL PROTECTED]
PO Box 969 http://herzberg.ca.sandia.gov
Livermore, CA 94550
---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list. List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------