diff --git a/jupyter-client.el b/jupyter-client.el index 9a56138..3f7f2e7 100644 --- a/jupyter-client.el +++ b/jupyter-client.el @@ -544,7 +544,7 @@ kernel whose kernelspec if SPEC." After CLIENT shuts down the kernel it is connected to, it is no longer connected to a kernel." (jupyter-do (jupyter-io client) - (jupyter-after + (jupyter-then (jupyter-idle (jupyter-request "shutdown")) (lambda (req) ;; Ensure the Emacs representation of the kernel also knows diff --git a/jupyter-monads.el b/jupyter-monads.el index 7f4917a..ec79a08 100644 --- a/jupyter-monads.el +++ b/jupyter-monads.el @@ -117,17 +117,15 @@ of the do block is the result of performing the last action in IO-VALUES." (declare (indent 0)) (if (zerop (length io-values)) 'jupyter-io-nil - (letrec ((after-chain + (letrec ((then-chain (lambda (io-values) (if (= (length io-values) 1) (car io-values) - `(jupyter-after ,(funcall after-chain (cdr io-values)) + `(jupyter-then ,(funcall then-chain (cdr io-values)) ,(car io-values)))))) - ,(funcall after-chain (reverse io-values))))) + (funcall then-chain (reverse io-values))))) -;; TODO: then? To write: "IO-A then IO-B." Also, I think then has -;; been used in other programs. -(defun jupyter-after (io-a io-b) - "Return an I/O action that performs IO-B after IO-A." +(defun jupyter-then (io-a io-b) + "Return an I/O action that performs IO-A then IO-B." (declare (indent 1)) (make-jupyter-delayed :value (lambda () @@ -459,14 +457,12 @@ TODO The form of content each sends/consumes." (defun jupyter-timeout (req) (list 'timeout req)) -(defun jupyter-idle-wait (req) - (jupyter-return-delayed - (if (jupyter-wait-until-idle req) req - (jupyter-timeout req)))) - (defun jupyter-idle (io-req) - (jupyter-after io-req #'jupyter-idle-wait)) - + (jupyter-then io-req + (lambda (req) + (jupyter-return-delayed + (if (jupyter-wait-until-idle req) req + (jupyter-timeout req)))))) (defun jupyter-request (type &rest content) "Return an IO action that sends a `jupyter-request'. TYPE is the message type of the message that CONTENT, a property