Hi all,
What is the DEFINED behavior for CE's (I.E. 'not' & 'test') when they
are passed a non-boolean value?
Context:
A number of the Jess functions return EITHER a boolean or some other
value (I.E. str-index, member$, system...)
When these are used in a CE, what is the DEFINED behavior when the
function return value is non-boolean?
Experimentation seems to indicate that the non-boolean value is
generally evaluated to true, but I don't really see this documented, so
I'm not sure how to properly handle such cases.
In particular, what is the RIGHT way to code function patterns with two
possible return types?
A few examples:
(defrule foo1
(test (str-index "foo" "foo was here"))
(test (> (str-index "foo" "foo was here") 0) )
(not (str-index "foo" "foo was here"))
(not (str-index "goo" "foo was here"))
=>
(printout t "index " (str-index "foo" "foo was here") " matches
test, test >0, not, not goo!" crlf)
)
(defrule foo2-contrived-eg
(test (+ 1 1)) ; Dont' try this at home - but jess does accept it...
(not (+ 1 1))
=>
(printout t "1+1 both tests and not!" crlf)
)
The apparent overloaded behavior of test and not can be useful in some
contexts, but is it legitimate?
Jack
(ps tested in jess 5.xxx)
---------------------------------------------------------------------
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]
---------------------------------------------------------------------