(defclass RBR-object () ((name :accessor name :initform 'unknown :initarg :name ) (TT-slot :accessor TT-slot :initform 'unknown :initarg :TT-slot)) ) ;; function to make instances of defined classes ;; this can used directly on the RHS of rules as ;; well as at top level to construct the instances of an object base ;; first tests that intended instance is a sub of RBR-object ;; increments global time tag (defun make-RBR-instance (&rest args) "takes all args passed to make-RBR-instance and passes them to make-instance" (if (not (typep (first args) RBR-object)) (and (print 'error)nil ) (let ((args-w-tag (append args (list ':TT-slot *tag*)))) (push (apply #'make-instance args-w-tag) *OB* ) (setf *tag* (+ *tag* 1))))) ;; the following illustrates the creation of a single RBR instance by ;; the use of make-RBR-instance ; ;(make-RBR-instance 'train ; :place 4 ; :in-motion 'yes ; :name 1 ) ;note slot and accessor inherited from RBR-object