You can't do it in a template, but you COULD conceivably do it using
JessEvents; the FACT | ASSERTED event arrives right before the fact
is pushed through working memory, so you could actually change the
slot contents in a handler; this could be used to set a default value.


On Feb 11, 2008, at 6:27 AM, Henrique Lopes Cardoso wrote:

Hi,

I was wondering if there is a way of setting a default value for a
slot
to be equal to another slot.
Something like:

(deftemplate foo
    (slot bar)
    (slot qwe (default-dynamic this.bar))))

(assert (foo (bar 1)))

Slot qwe would get the value of slot bar, that is, 1.


---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences          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]
--------------------------------------------------------------------

Reply via email to