Thank you both.

(defglobal ...) worked fine.

...on to backward chaining. ;)

-Mitch

FYI, Making $10.00 in 100 coins took over an hour, and consumed >125meg RAM,
but suceeded just fine.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of [EMAIL PROTECTED]
Sent: Monday, August 11, 2003 2:33 PM
To: [EMAIL PROTECTED]
Subject: Re: JESS: Newbie question (Coin puzzle-SOLVED)


I think Mitch Christensen wrote:

>
> A bit off topic, but I get a "variable not bound" exception if I use a
> variable in the pattern to replace the hard-coded '50' and '100' values.
Is
> it illegal to reference a bound variable in a pattern?  (offending code
> snippet below...)
>


Have a look at the section entitled "Global variables" starting on
page 48 of "Jess in Action." Short answer: variables defined at the
top-level prompt aren't "global", they're just "top-level" and they're
not accessible from rules. You can and should use "defglobals" for
what you want to do; this section of JIA described how.

(Oh, joy, this is the first time I've answered a FAQ with a page
reference to JIA...)





---------------------------------------------------------
Ernest Friedman-Hill
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 [EMAIL PROTECTED]
Livermore, CA 94550         http://herzberg.ca.sandia.gov

--------------------------------------------------------------------
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]
--------------------------------------------------------------------

Reply via email to