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)))
|
(lambda (msg) (funcall (proc scope) msg scope)))
|
||||||
|
|
||||||
(defun std-proc (msg scope &key (default #'remember) params actions)
|
(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)
|
(handle-action msg scope :default default :actions actions :params params)
|
||||||
(forward nmsg (syns nscope))
|
(forward nmsg (syns nscope))
|
||||||
(update nscope)))
|
(update nscope)))
|
||||||
|
|
||||||
(defun eff-proc (msg scope &key params actions)
|
(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)
|
(handle-action msg scope :default #'no-op :actions actions :params params)
|
||||||
(notify nmsg nscope)
|
(notify nmsg nscope)
|
||||||
(update nscope)))
|
(update nscope)))
|
||||||
|
|
@ -112,9 +112,8 @@
|
||||||
|
|
||||||
;;;; predefined neuron actions
|
;;;; predefined neuron actions
|
||||||
|
|
||||||
(defun no-op (msg scope)
|
(defun no-op (msg scope) msg)
|
||||||
(list msg scope))
|
|
||||||
|
|
||||||
(defun remember (msg scope)
|
(defun remember (msg scope)
|
||||||
(setf (value scope) (shape:data-value msg :value))
|
(setf (value scope) (shape:data-value msg :value))
|
||||||
(list msg scope))
|
(values msg scope))
|
||||||
|
|
|
||||||
|
|
@ -32,12 +32,12 @@
|
||||||
(addr (getf data :addr)))
|
(addr (getf data :addr)))
|
||||||
(when addr
|
(when addr
|
||||||
(register-cell (cells scope) addr (getf data :new)))
|
(register-cell (cells scope) addr (getf data :new)))
|
||||||
(list msg scope)))
|
msg))
|
||||||
|
|
||||||
(defun forward (msg scope)
|
(defun forward (msg scope)
|
||||||
(dolist (cell (find-cells (cells scope) (message:addr msg)))
|
(dolist (cell (find-cells (cells scope) (message:addr msg)))
|
||||||
(actor:send cell msg))
|
(actor:send cell msg))
|
||||||
(list msg scope))
|
msg)
|
||||||
|
|
||||||
;;;; helpers
|
;;;; helpers
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
(defun proc-env (msg scope)
|
(defun proc-env (msg scope)
|
||||||
(let ((t:*test-suite* (csys:environ 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))
|
(csys:handle-action msg scope :actions (environ:actions))
|
||||||
(util:lgi nmsg (tc:receiver t:*test-suite*))
|
(util:lgi nmsg (tc:receiver t:*test-suite*))
|
||||||
(actor:send (core:mailbox (tc:receiver t:*test-suite*)) nmsg))))
|
(actor:send (core:mailbox (tc:receiver t:*test-suite*)) nmsg))))
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue