JESS: simple calculation problem
hi, im trying to add a number to another number which keeps increasing on every rule that is what i have: (defrule fight (object knife) = (assert (Fight)) (assert (update-scores 10)) (printout t Fight ! crlf) ) (defrule update-scores (update-scores ?c) = (call ?s setAgr (+ (call ?s getAgr) ?c))) and i want it to be something like: score starts with 0 and when rule fight is fire then it should add 10 so the final score is 10 and if another rule is fired it will add also 10 and then the final score is 20 etc... how can i do that? what i have now is just replacing and not adding best regards, m.ismail _ Veilig gerust mailen met de verbeterde antivirusscan van Live Mail! http://imagine-windowslive.com/mail/launch/default.aspx?Locale=nl-nl 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]
JESS: how to get the rule text from a defrule
Hi, With Jesp I can easily get the defrule of each of my rules in my .clp files and display their names in a Swing application. What I would like to do next is to display the actual text of the rule in this same application, can it be easily done ?Thanks. From: [EMAIL PROTECTED] Subject: Re: JESS: is jess a declaritive language? Date: Tue, 30 Jan 2007 22:03:15 -0500 To: jess-users@sandia.gov Well, rules themselves are definitely a declarative programming concept. But Jess also offers an imperative language, and in fact the right-hand-sides of rules consist of imperative code. So in fact, Jess, and systems like it, are hybrid declarative/ imperative. On Jan 30, 2007, at 5:03 PM, Matthew J Hutchinson wrote: Hi everyone, I'm trying to categorize Jess in terms of the different programming language paradigms. Is Jess declaritive? Thanks, Matt - Ernest Friedman-Hill Advanced Software Research Phone: (925) 294-2154 Sandia National Labs FAX: (925) 294-2234 PO Box 969, MS 9012 [EMAIL PROTECTED] 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] _ Soyez parmi les premiers à essayer Windows Live Mail. http://ideas.live.com/programpage.aspx?versionId=5d21c51a-b161-4314-9b0e-4911fb2b2e6d
Re: JESS: simple calculation problem
First, I don't know what ?s is. If it's a variable defined at the prompt, don't do that. It won't work reliably in Jess 6, and isn't even possible in Jess 7 (the fact that it's possible in Jess 6 is unintentional.) Otherwise, there's nothing wrong here, per se. Every time an update- scores fact is asserted, the count will be set to a new value. Of course, once an update-scores 10 fact exists, you can't assert another one until the original is retracted, so you might want to do that in the update-scores rule. On Jan 31, 2007, at 6:40 AM, M Ismail wrote: hi, im trying to add a number to another number which keeps increasing on every rule that is what i have: (defrule fight (object knife) = (assert (Fight)) (assert (update-scores 10)) (printout t Fight ! crlf) ) (defrule update-scores (update-scores ?c) = (call ?s setAgr (+ (call ?s getAgr) ?c))) and i want it to be something like: score starts with 0 and when rule fight is fire then it should add 10 so the final score is 10 and if another rule is fired it will add also 10 and then the final score is 20 etc... how can i do that? what i have now is just replacing and not adding best regards, m.ismail _ Veilig gerust mailen met de verbeterde antivirusscan van Live Mail! http://imagine-windowslive.com/mail/launch/default.aspx? Locale=nl-nl 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 owner-jess- [EMAIL PROTECTED] - Ernest Friedman-Hill Advanced Software Research Phone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 PO Box 969, MS 9012 [EMAIL PROTECTED] 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]
Re: JESS: how to get the rule text from a defrule
Use the jess.PrettyPrinter class, as described in the manual. An aside: *please* start a new thread for your new questions; please don't reply to an existing message, whether or not you delete the old contents while editing your message, unless you're answering someone else's question. If you send a reply rather than a new message, then threaded email readers (including archives of this list) show your messages as related to others that they're not actually related to. Thanks. On Jan 31, 2007, at 3:07 PM, Skeptic 2000 wrote: Hi, With Jesp I can easily get the defrule of each of my rules in my .clp files and display their names in a Swing application. What I would like to do next is to display the actual text of the rule in this same application, can it be easily done ? Thanks. From: [EMAIL PROTECTED] Subject: Re: JESS: is jess a declaritive language? Date: Tue, 30 Jan 2007 22:03:15 -0500 To: jess-users@sandia.gov Well, rules themselves are definitely a declarative programming concept. But Jess also offers an imperative language, and in fact the right-hand-sides of rules consist of imperative code. So in fact, Jess, and systems like it, are hybrid declarative/ imperative. On Jan 30, 2007, at 5:03 PM, Matthew J Hutchinson wrote: Hi everyone, I'm trying to categorize Jess in terms of the different programming language paradigms. Is Jess declaritive? Thanks, Matt - Ernest Friedman-Hill Advanced Software Research Phone: (925) 294-2154 Sandia National Labs FAX: (925) 294-2234 PO Box 969, MS 9012 [EMAIL PROTECTED] 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 owner-jess- [EMAIL PROTECTED] Soyez parmi les premiers à essayer Windows Live Mail. - Ernest Friedman-Hill Advanced Software Research Phone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 PO Box 969, MS 9012 [EMAIL PROTECTED] 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]
Re: JESS: is jess a declaritive language?
Whether to apply the declarative or imperative programming paradigms really depends much on how data and behaviour should be bound together in your problem domain. When the relationship between data and behaviour is fairly weak and highly dynamic, DSLs with declarative syntax built upon rule engines or workflow/process engines are more expressive to transfer the real-world scenarios to a computational model. Workflow/process engines emphasize on conducting the behaviour while rule engines emphasize on constraining the data. Declarative and imperative programming paradigms are not mutually exclusive and a good programming language (for example Jess), usually takes advantages of both paradigms to achieve maximal expressiveness. On 1/31/07, Doug Metzler [EMAIL PROTECTED] wrote: And the degree to which a production system leans toward the declarative or imperative end of the spectrum is as much a matter of programming style as the language itself. To the degree that you are thinking of each rule as a specification of what to do under a set of circumstances, with flow of control influenced strictly by how the KB changes, you are emphasizing declarative programming. To the extent that you are thinking explicitly about a specific flow of control as in convential programming you are moving toward procedural programming. Doug Metzler On Tue, 30 Jan 2007, Ernest Friedman-Hill wrote: Well, rules themselves are definitely a declarative programming concept. But Jess also offers an imperative language, and in fact the right-hand-sides of rules consist of imperative code. So in fact, Jess, and systems like it, are hybrid declarative/imperative. On Jan 30, 2007, at 5:03 PM, Matthew J Hutchinson wrote: Hi everyone, I'm trying to categorize Jess in terms of the different programming language paradigms. Is Jess declaritive? Thanks, Matt - Ernest Friedman-Hill Advanced Software Research Phone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 PO Box 969, MS 9012 [EMAIL PROTECTED] 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] 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] -- Ellen Ning Zhao Department of Computer Science University of Applied Science of Kaiserslautern at Zweibruecken 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]
Re: JESS: simple calculation problem
Hi, I guess you should retract the update-scores fact in the rhs of the update-scores rule, otherwise you will not be able to assert a new update-scores fact (and therefore the update-scores rule will not fire again). Henrique M Ismail wrote: hi, im trying to add a number to another number which keeps increasing on every rule that is what i have: (defrule fight (object knife) = (assert (Fight)) (assert (update-scores 10)) (printout t Fight ! crlf) ) (defrule update-scores (update-scores ?c) = (call ?s setAgr (+ (call ?s getAgr) ?c))) and i want it to be something like: score starts with 0 and when rule fight is fire then it should add 10 so the final score is 10 and if another rule is fired it will add also 10 and then the final score is 20 etc... how can i do that? what i have now is just replacing and not adding best regards, m.ismail _ Veilig gerust mailen met de verbeterde antivirusscan van Live Mail! http://imagine-windowslive.com/mail/launch/default.aspx?Locale=nl-nl 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] -- - - - - - - - - - - - - - Henrique Lopes Cardoso DEEC/FEUP Rua Dr. Roberto Frias | 4200-465 Porto PORTUGAL (+351)225081400 ext.1315 [EMAIL PROTECTED] | www.fe.up.pt/~hlc - - - - - - - - - - - - - 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]