;;;; decons/csys - cybernetic communication systems (defpackage :decons/csys (:use :common-lisp) (:local-nicknames (:actor :scopes/core/actor) (:util :scopes/util)) (:export #:neuron #:synapse #:forward #:set-content)) (in-package :decons/csys) (defun neuron (proc &key state syns env) (actor:create (lambda (msg) (funcall proc msg state syns env)))) (defun synapse (rcvr &optional (op #'identity)) (lambda (msg) (actor:send rcvr (funcall op msg)))) ;;;; simple default / example neuron processors (defun forward (msg state syns env) (dolist (s syns) (funcall s msg))) ;;;; helpers for operating on messages (defun set-content (fn) (lambda (msg) (actor:message (funcall fn (actor:content msg)) (actor:customer msg))))