我正在將一些Scheme代碼轉換爲Common Lisp。我不知道計劃。我知道一點Common Lisp。將Scheme調用與當前繼續轉換爲Common Lisp?
下面是計劃代碼:
(define (with-process-abortion thunk)
(call-with-current-continuation
(lambda (k)
(fluid-let ((*abort-process* k))
(thunk)))))
的方案call-with-current-continuation
功能我做了一些閱讀,但說實話,我不知道上述功能正在做什麼。我轉換到Common Lisp是在這個時候非常骨骼:
(defun with-process-abortion (thunk)
;; No idea how to implement
)
通話的每次出現/立方厘米可與以下 等價物來替換:
(拉姆達( fk)(f(lambda(v k0)(kv))k))
其中k是要保存的延續,並且(lambda(v k0)(kv))是 escap e恢復此延續的程序(不管 延續k0在被調用時處於活動狀態,都將被丟棄)。
好吧,f
對應於我的情況? k
對應什麼?
取代
(*abort-process*)
非常感謝您@Doug庫裏。我會試一試。 –'thunk'需要像'(defun with-process-abortion(thunk)(catch'wpa(funcall thunk)))' – Sylwester
謝謝@Sylwester! –