work in progress: csys setup: create zero neuron
This commit is contained in:
parent
7c78f1df2f
commit
560d423435
3 changed files with 16 additions and 10 deletions
|
|
@ -62,19 +62,26 @@
|
|||
(defun update (scope)
|
||||
(actor:become (process scope)))
|
||||
|
||||
(defun create (prg env &key (categ '(:csys :c00)) name value)
|
||||
(let* ((domain (car categ))
|
||||
(addr (when name (list domain (cadr categ) name)))
|
||||
(scope (scope prg env :categ categ))
|
||||
(msg (message:create (list domain :create)
|
||||
:data (when addr (list :addr addr)))))
|
||||
(do-create msg scope)))
|
||||
|
||||
;;;; message handlers, proc steps
|
||||
|
||||
(defun process (scope)
|
||||
(lambda (msg) (funcall (proc scope) msg scope)))
|
||||
|
||||
(defun std-proc (msg scope)
|
||||
;(util:lgi msg state syns env)
|
||||
(destructuring-bind (nmsg nscope)
|
||||
(handle-action msg scope :default #'remember) ; + params, actions
|
||||
(forward nmsg (syns nscope))
|
||||
(update nscope)))
|
||||
|
||||
(defun create (msg scope)
|
||||
(defun do-create (msg scope)
|
||||
(let ((new (neuron (apply #'reset-scope scope (shape:data msg)))))
|
||||
(notify-created msg new scope)))
|
||||
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@
|
|||
(defclass scope (csys:scope)
|
||||
((cells :reader cells :initform (make-hash-table :test #'equal))))
|
||||
|
||||
(defun create (proc app)
|
||||
(let ((prog (csys:make-program proc)))
|
||||
(csys:neuron (csys:scope prog app :cls 'scope :categ '(:env :c00)))))
|
||||
(defun create (proc meta-env)
|
||||
(let ((prg (csys:make-program proc)))
|
||||
(csys:neuron (csys:scope prg meta-env :cls 'scope :categ '(:env :c00)))))
|
||||
|
||||
;;;; action handlers, public callables
|
||||
|
||||
|
|
|
|||
|
|
@ -55,14 +55,13 @@
|
|||
(defun setup-test-basic-0 ()
|
||||
(setup-config)
|
||||
(core:setup-services)
|
||||
(setf (tc:receiver t:*test-suite*) (core:find-service :test-receiver))
|
||||
;(csys:add-action '(:csys :sensor) #'csys:create-sensor)
|
||||
(let* ((env (environ:create #'proc-env (tc:receiver t:*test-suite*)))
|
||||
(let* ((app (core:find-service :test-receiver))
|
||||
(env (environ:create #'proc-env app))
|
||||
(msg (message:create '(:csys :create)
|
||||
:data `(:addr (:csys :c00 "0-0")
|
||||
:categ :c00
|
||||
:environ ,env))))
|
||||
;(csys:create) ; or: (environ:setup program:basic-0 #'proc-env)
|
||||
(setf (tc:receiver t:*test-suite*) app)
|
||||
;(csys:create-zero (test-program) env)
|
||||
))
|
||||
|
||||
(deftest test-basic-0 ()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue