With great trepidation I toss this into the "dueling typos" exchange. Both of my implementations of 5.1 and 6.0a3 hiccuped on your example. Could you clarify why your example should work? Has something changed with deffacts in 6.0a5+ ? Here is my example which does work on both of my implementations: (defglobal ?*foo* = 1) (deftemplate foo (slot bar)) (defrule foo (foo (bar ?x&:(eq ?x ?*foo*))) => ( printout t " Rule foo fired with (bar " ?x ")" crlf ) ) (deffacts foo (foo (bar 1)) (foo (bar 2)) (foo (bar 3))) (watch all) (reset) (run) Thanks, -Ed Katz -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, March 16, 2001 8:43 AM To: Willie Wheeler Cc: [EMAIL PROTECTED] Subject: Re: JESS: Matching globals We seem to be playing "dueling typos." The missing question marks in my mail were a single typo, multiplied by cut and paste. In your rule below, you're got the &:(eq... outside the parens for the path slot -- Jess oughtn't to have parsed this, but again, I don't know if you just made an email typo. In any case, here's a complete working example, cut-and-pasted from an actual session this time. (defglobal ?*foo* = 1) (deftemplate foo (slot bar)) (defrule foo (foo (bar ?x&:(eq ?x ?*foo*))) => ) (deffacts foo (foo 1) (foo 2) (foo 3)) (reset) (watch all) (run) The rule foo fires once for Fact-1. I think Willie Wheeler wrote: > Hi Ernest, > > Thanks very much for your response. I tried what you gave, and I > couldn't get the match to happen. (I noticed that the left hand argument > to eq doesn't have a question mark--I tried it without and with.) > Here is what I tried: > > > ?path-node <- (path-node (path ?path-id)&:(eq ?path-id ?*selected-path-id*)) > (node ?node-id) > (act-classification nil)) > > > That doesn't work. But when I do the following: > > > ?path-node <- (path-node (path ?path-id) > (node ?node-id) > (act-classification nil)) > (test (eq ?path-id ?*selected-path-id*)) > > > it works just fine. And so problem is solved, though I'd like to know > why the first way isn't working if you see it. (Again, I tried it without > the ? in front of path-id as well, as your examples seemed to suggest.) > > Thanks, > Willie > > > > On Fri, 16 Mar 2001, friedman_hill ernest j wrote: > > > > > (get-var) was a kludge to let you refer to globals on rule LHSs at all > > -- i.e., to allow you to even use them in expressions like > > > > (foo (bar ?a&:(eq a (get-var ?*b*)))) > > > > Nowadays you can just write > > > > (foo (bar ?a&:(eq a ?*b*))) > > > > So the get-var function doesn't exist anymore. The ability to directly > > match defglobals, something like > > > > (defrule foo > > (global ?*b* 37) > > > > is something that we have indeed talked about, but I've never > > implemented. > > > > > > I think Willie Wheeler wrote: > > > Hi all, > > > > > > I am trying to figure out how to match globals on the left-hand > > > side. I searched the archives and found Jess's behavior with respect to > > > this issue characterized variously as a bug and as a idiosyncracy, and I > > > even found a message where a "matchable" attribute for defglobal was > > > proposed, but there is no mention of a solution. (Well, there was one > > > mention of a get-var function being involved, but I don't see any such > > > function in the manual and it doesn't seem to work in the code.) > > > > > > Willie > > > > > > > > > > > > > > --------------------------------------------------------- > > Ernest Friedman-Hill > > Distributed Systems Research Phone: (925) 294-2154 > > Sandia National Labs FAX: (925) 294-2234 > > Org. 8920, MS 9012 [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 (use your own address!) List problems? Notify [EMAIL PROTECTED] > --------------------------------------------------------------------- > --------------------------------------------------------- Ernest Friedman-Hill Distributed Systems Research Phone: (925) 294-2154 Sandia National Labs FAX: (925) 294-2234 Org. 8920, MS 9012 [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 (use your own address!) List problems? Notify [EMAIL PROTECTED] --------------------------------------------------------------------- --------------------------------------------------------------------- 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] ---------------------------------------------------------------------
