jupyter-after -> jupyter-then

This commit is contained in:
Nathaniel Nicandro 2020-05-15 16:58:25 -05:00
parent 12ca9caf3c
commit bd7a49fec6
2 changed files with 11 additions and 15 deletions

View file

@ -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

View file

@ -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