I think that Dan Malka wrote:
>> i would like to know, how to test a multislot if it's fill or not.
>> what kind of function may i use?

Hi Dan,
If you mean that you want to know if a multislot has any values, you
could use the length$ function.  For example:

;; Let ?x be any variable that holds a list

(if (= (length$ ?x) 0) then
; Do something interesting
)

An admittedly contrived Jess script that uses this might be:
;;================ dan.clp ====================
(clear)
(watch all)

(deftemplate foo
 (slot id)
 (multislot data))

(defrule delete-empty-foos
"Retracts all foo facts with no data"
 ?f <- (foo (data $?data&:(= (length$ $?data) 0)))
=>
 (retract ?f))

(reset)
(assert (foo (id abc123)))
(run)

If you run this batch file, Jess prints out:

MAIN::delete-empty-foos: +1+1+1+1+t
==> Focus MAIN
==> f-0 (MAIN::initial-fact)
==> f-1 (MAIN::foo (id abc123) (data ))
==> Activation: MAIN::delete-empty-foos :  f-1
FIRE 1 MAIN::delete-empty-foos f-1
<== f-1 (MAIN::foo (id abc123) (data ))
<== Focus MAIN

Click here for more info:
http://herzberg.ca.sandia.gov/jess/docs/61/functions.html#length$

Cheers,
Jason

-------------------
Morris Technical Solutions
www.morristechnicalsolutions.com
[EMAIL PROTECTED]
phone/fax: 503.692.1088


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