I think Mitch Christensen wrote: [Charset iso-8859-1 unsupported, filtering to ASCII...] > > PROBLEM: Define a set of coins amounting to exactly $1.00 using exactly 50 > coins. > > APPROACH: I thought I'd assert he following facts, > > 2 Half dollar facts > 4 Quarter facts > 10 Dime facts > 20 Nickel facts > 100 Penny facts > > Then define a rule to print the facts such that the number of facts (coins) > is 50 and the value of the 50 facts equals 100 ($1.00).
Since the problem isn't to determine -which- of the 100 pennies to use, for example, it's really unnecessary to represent each one individually. If it -were- necessary, then you'd want to be able to distinguish them, somehow, so you'd give them an identifier: (deftemplate coin (slot type) (slot id (default-value (gensym*)))) (deftemplate coin-type (slot type) (slot value)) (bind ?count 50) (while (> ?count 0) (assert (coin (type penny)))) Each penny would then be unique. But I don't think I would do it this way. What if you had facts like (penny-count 0) (penny-count 1) (penny-count 2) ... (penny-count 50) (nickel-count 0) (nickel-count 1) (nickel-count 2) ... And then wrote a rule that matched one penny-count fact, one nickel-count fact, etc, such that the counts summed to 50, and the amounts summed to $1.00? --------------------------------------------------------- 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] --------------------------------------------------------------------
