anchor.diff:      (setf vib> (make-instance 'vibration-out-port :owner c))))
   
   
  -(defmethod initialize-instance ((w wire) &key)
  +(defmethod initialize-instance :after ((w wire) &key)
     (with-accessors ((a< a-vibration-in-of) (a> a-vibration-out-of)
   		   (b< b-vibration-in-of) (b> b-vibration-out-of)) w
       (setf a< (make-instance 'vibration-in-port :owner w))
       (setf a> (make-instance 'vibration-out-port :owner w))
       (setf b< (make-instance 'vibration-in-port :owner w))
       (setf b> (make-instance 'vibration-out-port :owner w))))
  +
  +
  +(defmethod initialize-instance :after ((p person) &key)
  +  (with-accessors ((tho< thought-in-of) (tho> thought-out-of)
  +		   (voi< voice-in-of) (voi> voice-out-of)) p
  +    (setf voi< (make-instance 'voice-in-port :owner p))
  +    (setf voi> (make-instance 'voice-out-port :owner p))
  +    (setf tho< (make-instance 'thought-in-port :owner p))
  +    (setf tho> (make-instance 'thought-out-port :owner p))))
  +
  +
  +(defun setup-csp ()
  +  (let* ((csp (make-instance 'csp-scenario))
  +	 (a (make-instance 'person :parents-path (path csp)
  +			   :name "Alice"))
  +	 (b (make-instance 'person :parents-path (path csp)
  +			   :name "Bob"))
  +	 (ac (make-instance 'can :parents-path (path csp)))
  +	 (bc (make-instance 'can :parents-path (path csp)))
  +	 (w (make-instance 'wire :parents-path (path csp))))
  +    ;; assign components
  +    (setf (cans-of csp)
  +	  (cons ac bc))
  +    (setf (wire-of csp)
  +	  w)
  +    (setf (persons-of csp)
  +	  (cons a b))
  +    ;; setup i/o connections between ports
  +    ;; Alice with her can
  +    (i/o-connect (voice-out-of a)
  +		 (voice-in-of ac))
  +    ;; Bob with his can
  +    (i/o-connect (voice-out-of b)
  +		 (voice-in-of bc))
  +    ;; Alice's can with Alice's end of wire
  +    (i/o-connect (vibration-out-of ac)
  +		 (a-vibration-in-of w))
  +    (i/o-connect (a-vibration-out-of w)
  +		 (vibration-in-of ac))
  +    ;; Bob's can with Bob's end of wire
  +    (i/o-connect (vibration-out-of bc)
  +		 (b-vibration-in-of w))
  +    (i/o-connect (b-vibration-out-of w)
  +		 (vibration-in-of bc))
  +    csp))
  +
  +
  +(defun vibration->voice (vi)
  +  (declare (vibration vi))
  +  (the vibration
  +    (make-instance 'vibration :message (message-of vi))))
  +
  +
  +(defun voice->vibration (vo)
  +  (declare (voice vo))
  +  (the vibration
  +    (make-instance 'vibration :message (message-of vo))))
  +
  +
  +(defmethod think ((p person) (evs list))
  +  (schedule p (make-instance 'i/o-event
  +			     :time (gettime evs)
  +			     :fn #'put
  +			     :args (list (thought-in-of p)))))
  +
  +
  +(defmethod handle-input ((p person) (in thought-in-port) (str string))
  +  (put (voice-out-of p)
  +       (make-instance 'voice :message str)))
  +
  +
  +(defmethod run ((csp csp-scenario))
  +  (labels ((run-rec (csp evs)
  +	     (if (null evs)
  +		 csp
  +		 (multiple-value-call #'run-rec (evolve csp evs)))))
  +    (multiple-value-bind (evs csp)
  +	(schedule (events-of csp) 0 #'think (car (persons-of csp)))
  +      (run-rec csp evs))))
  
positive.code: 
  
  (defclass voice-out-port (out-port)
    nil)
  
  
  
negative.code: (in-package :csp-sim)
  
  
  (defgeneric think (person events)
    (:documentation "TODO"))
  
  
  (defclass vibration-in-port (in-port)
    nil)
  
  