The 'if' statement you've written looks as if it should be OK, but
it's rather a dark corner of language syntax, and there may indeed be
a bug there. Did you try the equivalent, but probably functional

(if (eq ?myVar 0) then (bind $?arrayToUse $?arrayA)
                  else (bind $?arrayToUse $?arrayB))

I'll have a look at why the other form is broken.

I think Kenny Macleod wrote:
> 
> Folks,
> 
> I think I may have run into a possible bug in Jess 4.4.  On the other
> hand, I could just be doing something daft and not realising it.
> 
> I am trying to invoke the (call) function on a Java static method.  This
> method takes a single argument, an array of bytes.
> 
> In the rules, this argument can be one of two pre-defined multivariable
> values, call them $?arrayA and $?arrayB.  Now, I can call the method
> using the following syntax:
> 
>       (call mypackage.myclass mymethod $?arrayA)
> 
> That works fine.  However, I want to select the argument to pass
> depending on the value of another variable, call it ?myvar:
> 
>       (bind $?arrayToUse (if (eq ?myvar 0) then $?arrayA else
> $?arrayB))
>       (call mypackage.myclass mymethod $?arrayToUse)
> 
> When I try it this way, I get a Rete exception ("method mymethod not
> found or invalid argument types").
> 
> Am I using the multivariable values correctly, or is the 'if' statement
> returning values of the wrong type here?  After further poking around,
> it seems that the $?arrayToUse variable is of type RU.MULTIFIELD.  The
> ReteException, however, is being thrown from within
> Jess.Value.listValue(), which only accepts values of type RU.LIST.
> 
> Any thoughts on what's going wrong here?
> 
> Regards
> 
> 
> Kenny
>  
> 
> ------------------------------------------------------
> Kenny MacLeod          | 
>                        | Email: [EMAIL PROTECTED]
> Mutant Technology Ltd  | Tel:   (+44) 171 257 9988
> 12-13 Henrietta Street | Fax:   (+44) 171 836 2600
> London, UK WC2E 8LH    | WWW:   www.mutant-tech.com
> ------------------------------------------------------
> ---------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the
> list. List problems? Notify [EMAIL PROTECTED]
> ---------------------------------------------------------------------
> 
> 


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

---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list. List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------

Reply via email to