Hi,

I'm sorry if this is a very basic question, but I'm begining to learn
rule-based systems and lisa. How do I test for the length of something
in the LHS?

I have this class:

(defclass sonority ()
  ((notes :reader notes :initarg :notes :initform nil)

this rule of course works:

(defrule rule-3 ()
  (sonority (notes ?x))
  =>
  (print ?x))

I want to match if the list in the slot "notes" have 4 elements,
something like this in "pseudo"/lisp-code:

(defrule rule-4 ()
  (eql (lenght (sonority (notes ?x))) 4)
  =>
  (print ?x))

I tried the following, but it didn't work:

(defrule rule-4 ()
  (test (sonority (eql (length (notes) 4))))
  =>
  (print 'foo))

This is how I'm testing it:

(defun test ()
  (assert (sonority (notes '(55 14 83 55))))
  (run))

Pedro

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