Re: JESS: Get fact's slot value

Gaëtan Pruvost <[email protected]>
Newsgroups gmane.comp.java.jess
Message-ID <[email protected]>
First of all, you might tell us why you don't want to use modify? I 
can't see any good reason for that.

I think a perfectly valid notation in your case would be :
(modify ?new (expense (+ 2000 ?new.expense)))

Now if you're not familiar with LISP-like notation, you have a lot of 
guidance here:
http://www.jessrules.com/jess/docs/71/basics.html

***********************************
Gaëtan PRUVOST

LIMSI-CNRS BP 133
91403 Orsay Cedex France
Tel:+33 1 69858110

http://www.limsi.fr/Individu/pruvost/
***********************************


Le 22/11/2010 16:19, alvin0618 a écrit :
> expense = expense + 2000; // trying to get the previous amount add up with
> the current amount
>
> (deftemplate (slot name) (slot age) (slot expense))
> (bind ?new (assert (person (name Fred) (age 22) (expense 2000))))
>
> Instead of using the way like this:
> (modify ?new (expense 3000)) ;
>
gaetan_pruvost.vcf (text/plain, 188 B)
begin:vcard
fn;quoted-printable:Ga=C3=ABtan Pruvost
n;quoted-printable:Pruvost;Ga=C3=ABtan
email;internet:[email protected]
tel;work:+33 1
x-mozilla-html:TRUE
version:2.1
end:vcard
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.