Re: hierarchical data in clips



"zslevi@xxxxxxxxx" <levilista@xxxxxxxxx> writes:

I'm a newbie to Lisp and CLIPS.
I just wondered how can I make a deftemplate-s slot to contain an
instance of other deftemplates? (Or how can I do the same with
defclasses?)
I tried to use

(type OBJECT)

but it didn't work. Please show me some example code, how to do it.

In CL, DEFCLASS defines both a class and a type of same name.

So you can write:

(defclass wheel () ((radius :type float :initarg :radius :accessor radius)))
(defclass automobil () ((wheels :type (vector wheel) :initarg :wheels :accessor wheels)))

(make-instance 'automobil :wheels (vector (make-instance 'wheel :radius 10.0)))


--
__Pascal Bourguignon__
.