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)
|
(defun update (scope)
|
||||||
(actor:become (process 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
|
;;;; message handlers, proc steps
|
||||||
|
|
||||||
(defun process (scope)
|
(defun process (scope)
|
||||||
(lambda (msg) (funcall (proc scope) msg scope)))
|
(lambda (msg) (funcall (proc scope) msg scope)))
|
||||||
|
|
||||||
(defun std-proc (msg scope)
|
(defun std-proc (msg scope)
|
||||||
;(util:lgi msg state syns env)
|
|
||||||
(destructuring-bind (nmsg nscope)
|
(destructuring-bind (nmsg nscope)
|
||||||
(handle-action msg scope :default #'remember) ; + params, actions
|
(handle-action msg scope :default #'remember) ; + params, actions
|
||||||
(forward nmsg (syns nscope))
|
(forward nmsg (syns nscope))
|
||||||
(update nscope)))
|
(update nscope)))
|
||||||
|
|
||||||
(defun create (msg scope)
|
(defun do-create (msg scope)
|
||||||
(let ((new (neuron (apply #'reset-scope scope (shape:data msg)))))
|
(let ((new (neuron (apply #'reset-scope scope (shape:data msg)))))
|
||||||
(notify-created msg new scope)))
|
(notify-created msg new scope)))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,9 @@
|
||||||
(defclass scope (csys:scope)
|
(defclass scope (csys:scope)
|
||||||
((cells :reader cells :initform (make-hash-table :test #'equal))))
|
((cells :reader cells :initform (make-hash-table :test #'equal))))
|
||||||
|
|
||||||
(defun create (proc app)
|
(defun create (proc meta-env)
|
||||||
(let ((prog (csys:make-program proc)))
|
(let ((prg (csys:make-program proc)))
|
||||||
(csys:neuron (csys:scope prog app :cls 'scope :categ '(:env :c00)))))
|
(csys:neuron (csys:scope prg meta-env :cls 'scope :categ '(:env :c00)))))
|
||||||
|
|
||||||
;;;; action handlers, public callables
|
;;;; action handlers, public callables
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,14 +55,13 @@
|
||||||
(defun setup-test-basic-0 ()
|
(defun setup-test-basic-0 ()
|
||||||
(setup-config)
|
(setup-config)
|
||||||
(core:setup-services)
|
(core:setup-services)
|
||||||
(setf (tc:receiver t:*test-suite*) (core:find-service :test-receiver))
|
(let* ((app (core:find-service :test-receiver))
|
||||||
;(csys:add-action '(:csys :sensor) #'csys:create-sensor)
|
(env (environ:create #'proc-env app))
|
||||||
(let* ((env (environ:create #'proc-env (tc:receiver t:*test-suite*)))
|
|
||||||
(msg (message:create '(:csys :create)
|
(msg (message:create '(:csys :create)
|
||||||
:data `(:addr (:csys :c00 "0-0")
|
:data `(:addr (:csys :c00 "0-0")
|
||||||
:categ :c00
|
|
||||||
:environ ,env))))
|
: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 ()
|
(deftest test-basic-0 ()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue