diff --git a/csys.lisp b/csys.lisp index 1b60291..2cfaab9 100644 --- a/csys.lisp +++ b/csys.lisp @@ -4,7 +4,8 @@ (:use :common-lisp) (:local-nicknames (:actor :scopes/core/actor) (:util :scopes/util)) - (:export #:neuron #:synapse)) + (:export #:neuron #:synapse + #:forward)) (in-package :decons/csys) @@ -14,4 +15,10 @@ (defun synapse (rcvr &optional (op #'identity)) (lambda (msg) - (actor:send rcvr (op msg)))) + (actor:send rcvr (funcall op msg)))) + +;;;; simple default / example neuron processors + +(defun forward (msg state syns env) + (dolist (s syns) + (funcall s msg))) diff --git a/test-csys.lisp b/test-csys.lisp index 68a7036..814229c 100644 --- a/test-csys.lisp +++ b/test-csys.lisp @@ -9,11 +9,11 @@ )) (deftest test-neuron () - (let ((prb (csys:neuron #'probe - :state '(42 43) - :env t:*test-suite*))) - (actor:send prb (actor:message 42)) - (actor:send prb (actor:message 43)) + (let* ((prb (csys:neuron #'probe :env t:*test-suite* :state '(42 43))) + (fw (csys:neuron #'csys:forward :syns (list (csys:synapse prb))))) + (actor:send fw (actor:message 42)) + (actor:send fw (actor:message 43)) (sleep 0.1) (actor:stop prb) + (actor:stop fw) ))