I think Mark Nahabedian wrote:

> Thanks.  I upgraded to 6.0b3 and made the few necessary alterations to
> my application (all in the Java glue code which makes the initial fact
> assertions).  The documentation is greatly improved.
> 
> I'm still having two problems however.
> 
> The first is that the test for set membership in my function
> test-equiv (code below) is always failing.  Various objects in my
> application are represented in Jess as generated atoms.  The problem
> might be because the variable $?set in the test-equiv function seems
> to be bound to a set of a set of atoms (note extra level of
> parentheses), rather than to a set of atoms.


Short answer: call getIcon on the return value of Token.fact and use
the returned Fact instead of the original one.

Long answer: this has come up on the list before, and although it's
confusing, it's actually a feature, not a bug. Imagine that a pattern
in your query looks like

(foo ?x $?y ?z)

This matches a foo fact with at least two fields; the first is
assigned to ?x, the last to ?z, and any remaining ones are assigned to
$?y, the multivariable. When you get the fact from Token.getFact, it
contains this information: the __data slot for this fact will be a
list containing three entries. The first is the value of ?x, the
second is the value of $?y (as a nested list) and the third is the
value of ?z. If there were two multivariables in a row, then they
could be matched more than one way, and there would be more than one
token, each with its own different sublists.

Anyway, in your case, there's only one sublist, and it's the whole
list -- but it's still a sublist. It's expected behaviour, so your
code can use nth$ to fetch the nested list from the value of $?set --
or you can just use the return value of getIcon, which is the
"canonical" fact, the fact in its original ("iconic," hence the awful
method name) form.


---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
Org. 8920, MS 9012                  [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
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to