Yep.  That works.

Many thanks...

On Feb 19, 2008, at 1:15 PM, Peter Lin wrote:


I believe you need to use

(length$ <multifield-expression>)

and then do a test to compare the two lengths. so the rule might
look like this

(defrule myrule
    (foo
        (my-list ?list1)
    )
    (foo
        (my-list ?list2)
    )
   (test (eq (length$ ?list1) (length$ ?list2) ) )
=>
  (printout t "the lists have the same length)
)

that's how I've done it in the past. there might be an easier way.

On Feb 19, 2008 4:04 PM, Hal Hildebrand <[EMAIL PROTECTED]>
wrote:
I've been struggling with trying to formulate a LHS which tries to
match the length of one of the fact's multislots with another slot.
For example:

(deftemplate foo (multislot my-list) (slot desired))

I've tried the following:

(foo (my-list ?my-list) (desired = (length$ ?my-list))

(foo { desired == (length$ my-list) } )

(foo  (my-list ?my-list { desired == (length$ ?my-list) } )


And even though desired is 0 and the length of the list is 0, the rule
simply won't fire.  Obviously, I'm missing something....

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