From: ······@gmail.com
Subject: hierarchical data in clips
Date: 
Message-ID: <ed7b45da-3c1e-4dd8-91a7-da4ae1647002@w74g2000hsh.googlegroups.com>
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.

From: Vagif Verdi
Subject: Re: hierarchical data in clips
Date: 
Message-ID: <6ab1c8ab-be3d-43dd-84f2-7138a5dd48f5@t12g2000prg.googlegroups.com>
On Apr 30, 4:58 am, ·······@gmail.com" <·········@gmail.com> wrote:
> I'm a newbie to Lisp and CLIPS.

CLIPS as in mistyped CLISP, or expert system CLIPS ?
From: ······@gmail.com
Subject: Re: hierarchical data in clips
Date: 
Message-ID: <4133b662-65a7-41fa-a1a3-bb6af68cc7b1@b1g2000hsg.googlegroups.com>
On May 1, 1:52 am, Vagif Verdi <···········@gmail.com> wrote:
> On Apr 30, 4:58 am, ·······@gmail.com" <·········@gmail.com> wrote:
>
> > I'm a newbie to Lisp and CLIPS.
>
> CLIPS as in mistyped CLISP, or expert system CLIPS ?

I meant the expert system.
From: Pascal J. Bourguignon
Subject: Re: hierarchical data in clips
Date: 
Message-ID: <7cskx31hon.fsf@pbourguignon.anevia.com>
·······@gmail.com" <·········@gmail.com> 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__
From: ······@gmail.com
Subject: Re: hierarchical data in clips
Date: 
Message-ID: <47f51728-18fb-4b66-88b7-3c46dbb921b3@l42g2000hsc.googlegroups.com>
On Apr 30, 5:33 pm, ····@informatimago.com (Pascal J. Bourguignon)
wrote:
> ·······@gmail.com" <·········@gmail.com> 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__

Thanks for the example.
By the way I didn't find "vector" in the manual (I guess its a one
dimensional array, but I'd like to look up the usage syntax) , which
dialect are you using? I'm using the one from http://clipsrules.sourceforge.net/
From: Pascal J. Bourguignon
Subject: Re: hierarchical data in clips
Date: 
Message-ID: <7c63ttyy14.fsf@pbourguignon.anevia.com>
·······@gmail.com" <·········@gmail.com> writes:

> On Apr 30, 5:33 pm, ····@informatimago.com (Pascal J. Bourguignon)
> wrote, in Common Lisp:
>> (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)))
>
> Thanks for the example.
> By the way I didn't find "vector" in the manual (I guess its a one
> dimensional array, but I'd like to look up the usage syntax) , which
> dialect are you using? I'm using the one from http://clipsrules.sourceforge.net/

It's a Common Lisp type.
http://www.lispworks.com/documentation/HyperSpec/Body/a_vector.htm

http://www.lispworks.com/documentation/HyperSpec/Front/


I notice that COOL defclass has not exactly the same syntax as CLOS defclass.
(COOL = CLIPS Object Oriented Language
 CLOS = Common Lisp Object System)


I fail to find much about arrays either in clipsrules.sourceforge.net
documentation, so I guess you'd have to write something like:

;; clips code follow, not common lisp:
;; See http://clipsrules.sourceforge.net/documentation/v630/bpg.htm

(defclass wheel 
    (slot radius (default 0.5))) ; meters
                 
(defclass automobil
    (is-a vehicule)
    (multi-slot wheels  (default (make-instance of wheel)
                                 (make-instance of wheel)
                                 (make-instance of wheel)
                                 (make-instance of wheel))
                         (access read-write)))

-- 
__Pascal Bourguignon__
From: ······@gmail.com
Subject: Re: hierarchical data in clips
Date: 
Message-ID: <d1796930-b7a9-4176-8087-2f4964dc88cd@r66g2000hsg.googlegroups.com>
On May 5, 10:07 am, ····@informatimago.com (Pascal J. Bourguignon)
wrote:
> ·······@gmail.com" <·········@gmail.com> writes:
> > On Apr 30, 5:33 pm, ····@informatimago.com (Pascal J. Bourguignon)
> > wrote, in Common Lisp:
> >> (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)))
>
> > Thanks for the example.
> > By the way I didn't find "vector" in the manual (I guess its a one
> > dimensional array, but I'd like to look up the usage syntax) , which
> > dialect are you using? I'm using the one fromhttp://clipsrules.sourceforge.net/
>
> It's a Common Lisp type.http://www.lispworks.com/documentation/HyperSpec/Body/a_vector.htm
>
> http://www.lispworks.com/documentation/HyperSpec/Front/
>
> I notice that COOL defclass has not exactly the same syntax as CLOS defclass.
> (COOL = CLIPS Object Oriented Language
>  CLOS = Common Lisp Object System)
>
> I fail to find much about arrays either in clipsrules.sourceforge.net
> documentation, so I guess you'd have to write something like:
>
> ;; clips code follow, not common lisp:
> ;; Seehttp://clipsrules.sourceforge.net/documentation/v630/bpg.htm
>
> (defclass wheel
>     (slot radius (default 0.5))) ; meters
>
> (defclass automobil
>     (is-a vehicule)
>     (multi-slot wheels  (default (make-instance of wheel)
>                                  (make-instance of wheel)
>                                  (make-instance of wheel)
>                                  (make-instance of wheel))
>                          (access read-write)))
>
> --
> __Pascal Bourguignon__

Thank you.