Section 3.3. Continuations
Sam (Don't Panic!)
- 章节名:Section 3.3. Continuations
Continuation是什么?
(call/cc (lambda (k) (* 5 4))) ;; => 20 (call/cc (lambda (k) (* 5 (k 4)))) ;; => 4在传递给`call/cc`的函数return之后调用该函数的continuation
(let ([x (call/cc (lambda (k) k))]) (x (lambda (ignore) "hi"))) ;; => "hi" (((call/cc (lambda (k) k)) (lambda (x) x)) "HEY!") ;; => "HEY!"
43人阅读
Sam对本书的所有笔记 · · · · · ·
-
Section 2.9. Assignment
通过let给函数一个内部状态 (define count (let ([next 0]) (lambda () (let ([v next]) (set...
-
Section 3.3. Continuations
-
Exercise 3.3.1
只用call/cc(而不是递归)实现循环输出数列: ((lambda (foo) (display (car foo)) (newline...
> 查看全部3篇
说明 · · · · · ·
表示其中内容是对原文的摘抄