You don't need to know the number of fields in a multislot to match
it. A multivariable $?x matches any number of fields (zero or more)
while a single variable ?x matches exactly one field. So to match the
field "foo" wherever it appears in a multifield, for instance, the
pattern would be

   ($?x "foo" $?y)

To match "foo" if and only if it's not the first field,

   (?x $?y "foo" $?z)

to match the last three fields with the variables a, b, and c:

   ($?x ?a ?b ?c)

etc. Does this fix your problem?


I think chetan bhatia wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> Hi,
>     I need some help with Deftemplate multislot values.
> 
>          I am trying to store some values as multislot. But I do not know how many 
>values I will have to store in each fact. After asserting the fact, I need to pattern 
>match the multislot field, but it seems that I have to know the number of values in 
>multislot. I would like to know how can I pattern match a multislot deftemplate 
>variable on the LHS of the rule.
> Any help would be appreciated. 
> 
> Thank you,
> chetan bhatia.



---------------------------------------------------------
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