I'm looking for a shorthand notation for this (the ultra fact is a
"singleton", enforced unique via an "invariant" rule):

(defquery find-ultra
 (ultra)
)

(deffunction u ()
 (bind ?ultra (run-query find-ultra))
 (printout t "ultradivisor: " (fact-slot-value (call (call ?ultra next) fact
1) divisor) crlf)
)

I'd like it to / thought it might be something like this:

(deffunction u ()
 (printout t "ultradivisor: " (fact-slot-value (call (call (run-query
(ultra)) next) fact 1) divisor) crlf)
)

(Of course, the above doesn't work because (ultra) is expected by Jess to be
a function all.) Have I missed a useful construct along the way?  You might
wonder why I'm looking for this.  I'd like to give a user who has access to
the jess command-line during run-time the ability to inspect some facts.
They could just type in (facts) and rifle through the output list of facts.
For a long list of facts, that could be unwieldy when a simple little
"inspector" function like my u() above would suffice.

I thought of something like binding the singleton fact to a defglobal, but I
think that fails due to modify being a retraction-assertion, which I believe
would break a prior binding.

Comments, suggestions, criticisms?

Reply via email to