I just realized a second ago...thank you! and I'm sorry to have bothered you
with something this silly...
Ernest Friedman-Hill wrote:
>
> THe arguments to a function in Jess never have parentheses around
> them, so "(fetch (A))" should be "(fetch A)".
>
> On May 20, 2010, at 3:12 PM, Tessa wrote:
>
>>
>> Hi, I'm new to Jess, and sadly not too good in java, I have read
>> posts about
>> this topic, but just couldn't find what could be wrong with my
>> code.:-(
>> This application should pass input from java to jess to evaluate
>> circuit
>> gates, then pass the result back to java. (school project)
>>
>> Jess file:
>>
>>
>> (deffunction AND(?a ?b)
>> (if (or (= ?a 0)(= ?b 0))then (return 0)else (return 1)))
>>
>> (deffunction OR(?a ?b)
>> (if (and (= ?a 0) (= ?b 0))then (return 0)else (return 1)))
>>
>> (deffunction NOT(?x)
>> (if (= ?x 1)then (return 0)else (return 1)))
>>
>> (deffunction XOR(?a ?b)
>> (if (<> ?a ?b) then (return 1)else (return 0)))
>>
>>
>>
>> (reset)
>>
>>
>>
>> Java code:
>>
>>
>> import jess.*;
>>
>> public class MainCircuit {
>>
>> public static void main(String[] argv)throws JessException,
>> java.io.IOException{
>>
>> int a=1,b=0,c=1;
>>
>> try
>> {
>> Rete engine = new Rete();
>> engine.clear();
>> engine.batch("Circuit evaluator.clp");
>>
>> engine.store("A", new jess.Value(a));
>> engine.executeCommand("(bind ?x (fetch(A)))");
>>
>> engine.store("B", new jess.Value(b));
>> engine.executeCommand("(bind ?y (fetch(b)))");
>>
>> engine.store("C", new jess.Value(c));
>> engine.executeCommand("(bind ?z (fetch(c)))");
>>
>> Value d = engine.executeCommand("(NOT (OR (AND ?y ?z) ?
>> x))");
>> Value e = engine.executeCommand("(AND (XOR ?x ?z) ?y)");
>>
>>
>> System.out.println("The given circuit's Output values
>> are : ");
>> System.out.println(d.intValue(engine.getGlobalContext()));
>> System.out.println(e.intValue(engine.getGlobalContext()));
>>
>> }
>> catch (JessException ex)
>> {
>> System.err.println(ex);
>> }
>>
>> }
>>
>> }
>>
>>
>> Error msg:
>>
>> Jess reported an error in routine Funcall.execute
>> while executing (A)
>> while executing (fetch (A))
>> while executing (bind ?x (fetch (A))).
>> Message: Undefined function A.
>> Program text: ( bind ?x ( fetch ( A ) ) ) at line 1 in file <eval
>> pipe>.
>>
>> Sry if it's stupid ... and thanks in advance if you answer!
>>
>> Tessa
>> --
>> View this message in context:
>> http://old.nabble.com/Java-Jess-store-fetch-issue-tp28625638p28625638.html
>> Sent from the Jess mailing list archive at Nabble.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]
>> .
>> --------------------------------------------------------------------
>
> ---------------------------------------------------------
> Ernest Friedman-Hill
> Informatics & Decision Sciences, Sandia National Laboratories
> PO Box 969, MS 9012, 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].
> --------------------------------------------------------------------
>
>
>
--
View this message in context:
http://old.nabble.com/JESS%3A-Java-Jess-store-fetch-issue-tp28625675p28626100.html
Sent from the Jess mailing list archive at Nabble.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].
--------------------------------------------------------------------