« Return to Thread: JESS: JessLong Illegal argument exception

Re: JESS: JessLong Illegal argument exception

by Ernest Friedman-Hill :: Rate this Message:

Reply to Author | View in Thread


On Jun 8, 2009, at 8:19 PM, Brian Rogosky wrote:

> Hello,
> I’m experiencing an “Illegal Argument” exception when calling the  
> “long” function.


Hi Brian,

It'll only throw that exception if the argument isn't a number,  
string, or symbol. For example, a list value with a single number in  
it would produce the error you're seeing; the list would display  
without parens in the error message:

Jess> (long (list 123))
Jess reported an error in routine long
        while executing (long (list 123)).
   Message: Illegal argument 123.
   Program text: ( long ( list 123 ) )  at line 1.

Since it looks like you are able to add a debug print at the point of  
failure, try something like

(printout t "The bad value is of type " (jess-type ?city) crlf)

If it prints anything other than INTEGER, FLOAT, STRING, SYMBOL, or  
FACT, then there's the problem.




---------------------------------------------------------
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 you@...'
in the BODY of a message to majordomo@..., NOT to the list
(use your own address!) List problems? Notify owner-jess-users@....
--------------------------------------------------------------------

 « Return to Thread: JESS: JessLong Illegal argument exception