First, let me say that strictly, this isn't legal. The ":" character
is a special character in Jess and although the parser is letting you
get away with asserting that fact, it really shouldn't. It should be
an error right there.
But given that you've already gotten into this situation, you could
actually write something like
(defrule foo (f ?x&:(eq ?x :)) => )
In recent versions of Jess, this will compile to the same exact
network as the original direct match you tried -- i.e., the function
call will be optimized away.
On Sep 2, 2009, at 11:20 AM, jo wrote:
Hi,
I have a fact with a field containing the symbol :
However I have not managed to match it with a rule. Is there a way
to achieve this?
Jess> (assert (f : ))
<Fact-0>
Jess> (defrule x (f : )=>)
Jess reported an error in routine Jesp.parseFuncall.
Message: Expected '(' at token ')'.
Program text: ( defrule x ( f : ) at line 2.
Jess> Jess reported an error in routine Jesp.parseExpression.
Message: Expected a '(', constant, or global variable at token '='.
Program text: = at line 2.
Jess> >
Jess> Jess reported an error in routine Jesp.parseExpression.
Message: Expected a '(', constant, or global variable at token ')'.
Program text: ) at line 2.
Jess> (defrule x (f ":")=> (printout t aaa))
TRUE
Jess> (run)
0
Jess> (watch all)
TRUE
Jess> (run)
0
Thanks
Joe
--------------------------------------------------------------------
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]
.
--------------------------------------------------------------------
---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences, Sandia National Laboratories
PO Box 969, MS 9012, Livermore, CA 94550
http://www.jessrules.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].
--------------------------------------------------------------------