I am converting some Scheme code to Common Lisp. I don't know Scheme. I know a bit of Common Lisp.
Here is the Scheme code:
(define (with-process-abortion thunk)
(call-with-current-continuation
(lambda (k)
(fluid-let ((*abort-process* k))
(thunk)))))
I did some reading on the Scheme call-with-current-continuation
function but, honestly, I have no idea what the above function is doing. My conversion to Common Lisp is very skeletal at this time:
(defun with-process-abortion (thunk)
;; No idea how to implement
)
This SO post says:
every occurrence of call/cc can be replaced with the following equivalent:
(lambda (f k) (f (lambda (v k0) (k v)) k))
where k is the continuation to be saved, and (lambda (v k0) (k v)) is the escape procedure that restores this continuation (whatever continuation k0 that is active when it is called, is discarded).
Okay, what would f
correspond to in my situation? What would k
correspond to?