I think Steve Solomon wrote: > If I have a string-typed slot, how can I distinguish between the string > "nil" and nil (null value) in a QueryResult? (Granted, using "nil" for a > string-typed slot value is perverse). Consider the interaction below. > Both "nil" and nil show up as "nil" using the getSymbol method. >
You can query the type of a value in Java with Value.type(), and in Jess with the predicate functions like (symbolp) and (stringp). The symbol (RU.SYMBOL) 'nil' is indisinguishable from a Java 'null', but the string (RU.STRING) "nil" has a different type. (stringp "nil") is true and (stringp nil) is false. Note that if you call a Java method that returns a String, it will return RU.STRING. For this reason, the Java String "nil" and the null reference are distinguishable. --------------------------------------------------------- Ernest Friedman-Hill Advanced Software Research Phone: (925) 294-2154 Sandia National Labs FAX: (925) 294-2234 PO Box 969, MS 9012 [EMAIL PROTECTED] Livermore, CA 94550 http://herzberg.ca.sandia.gov -------------------------------------------------------------------- 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] --------------------------------------------------------------------
