neuron: with additional 'env' argument; basic functionality for testing probe OK
This commit is contained in:
parent
0865fa9e65
commit
be91b6a446
2 changed files with 12 additions and 7 deletions
|
@ -8,9 +8,9 @@
|
||||||
|
|
||||||
(in-package :decons/csys)
|
(in-package :decons/csys)
|
||||||
|
|
||||||
(defun neuron (proc &key state syns)
|
(defun neuron (proc &key state syns env)
|
||||||
(actor:create
|
(actor:create
|
||||||
(lambda (msg) (funcall proc msg state syns))))
|
(lambda (msg) (funcall proc msg state syns env))))
|
||||||
|
|
||||||
(defun synapse (rcvr &optional (op #'identity))
|
(defun synapse (rcvr &optional (op #'identity))
|
||||||
(lambda (msg)
|
(lambda (msg)
|
||||||
|
|
|
@ -2,13 +2,18 @@
|
||||||
|
|
||||||
(in-package :decons/test-decons)
|
(in-package :decons/test-decons)
|
||||||
|
|
||||||
(defun probe (msg state syns)
|
(defun probe (msg state syns env)
|
||||||
(let ((t:*test-suite* state))
|
(let ((t:*test-suite* env))
|
||||||
(== (actor:content msg) 42)))
|
(== (actor:content msg) (pop state))
|
||||||
|
(lambda (msg) (probe msg state syns env))
|
||||||
|
))
|
||||||
|
|
||||||
(deftest test-neuron ()
|
(deftest test-neuron ()
|
||||||
(let ((prb (csys:neuron #'probe :state t:*test-suite*)))
|
(let ((prb (csys:neuron #'probe
|
||||||
|
:state '(42 43)
|
||||||
|
:env t:*test-suite*)))
|
||||||
(actor:send prb (actor:message 42))
|
(actor:send prb (actor:message 42))
|
||||||
(sleep 0.2)
|
(actor:send prb (actor:message 43))
|
||||||
|
(sleep 0.1)
|
||||||
(actor:stop prb)
|
(actor:stop prb)
|
||||||
))
|
))
|
||||||
|
|
Loading…
Add table
Reference in a new issue