use util:mv-bind for evaluating return values of action handlers
This commit is contained in:
parent
5b71b0d5e4
commit
2d30776e81
3 changed files with 7 additions and 8 deletions
|
|
@ -74,13 +74,13 @@
|
|||
(lambda (msg) (funcall (proc scope) msg scope)))
|
||||
|
||||
(defun std-proc (msg scope &key (default #'remember) params actions)
|
||||
(destructuring-bind (nmsg nscope)
|
||||
(util:mv-bind (nmsg &optional (nscope scope))
|
||||
(handle-action msg scope :default default :actions actions :params params)
|
||||
(forward nmsg (syns nscope))
|
||||
(update nscope)))
|
||||
|
||||
(defun eff-proc (msg scope &key params actions)
|
||||
(destructuring-bind (nmsg nscope)
|
||||
(util:mv-bind (nmsg &optional (nscope scope))
|
||||
(handle-action msg scope :default #'no-op :actions actions :params params)
|
||||
(notify nmsg nscope)
|
||||
(update nscope)))
|
||||
|
|
@ -112,9 +112,8 @@
|
|||
|
||||
;;;; predefined neuron actions
|
||||
|
||||
(defun no-op (msg scope)
|
||||
(list msg scope))
|
||||
(defun no-op (msg scope) msg)
|
||||
|
||||
(defun remember (msg scope)
|
||||
(setf (value scope) (shape:data-value msg :value))
|
||||
(list msg scope))
|
||||
(values msg scope))
|
||||
|
|
|
|||
|
|
@ -32,12 +32,12 @@
|
|||
(addr (getf data :addr)))
|
||||
(when addr
|
||||
(register-cell (cells scope) addr (getf data :new)))
|
||||
(list msg scope)))
|
||||
msg))
|
||||
|
||||
(defun forward (msg scope)
|
||||
(dolist (cell (find-cells (cells scope) (message:addr msg)))
|
||||
(actor:send cell msg))
|
||||
(list msg scope))
|
||||
msg)
|
||||
|
||||
;;;; helpers
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
(defun proc-env (msg scope)
|
||||
(let ((t:*test-suite* (csys:environ scope)))
|
||||
(destructuring-bind (nmsg scope)
|
||||
(util:mv-bind (nmsg &optional (scope scope))
|
||||
(csys:handle-action msg scope :actions (environ:actions))
|
||||
(util:lgi nmsg (tc:receiver t:*test-suite*))
|
||||
(actor:send (core:mailbox (tc:receiver t:*test-suite*)) nmsg))))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue