Re: hierarchical data in clips
- From: pjb@xxxxxxxxxxxxxxxxx (Pascal J. Bourguignon)
- Date: Wed, 30 Apr 2008 17:33:12 +0200
"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__
.
- References:
- hierarchical data in clips
- From: zslevi@xxxxxxxxx
- hierarchical data in clips
- Prev by Date: Re: Questions - Higer Order Functions
- Next by Date: Re: CLtL2 copyright question
- Previous by thread: hierarchical data in clips
- Next by thread: Problem with build on ubuntu 8.04
- Index(es):