什么是scheme continuation?

看了一两个小时才看明白,什么叫continuation,

其实是这样的

举个例子

 

(+ 1 (call/cc
       (lambda (k)
         (+ 2 (k 3)))))

the rest of the program, from the point of view of the call/cc-application, is the following program-with-a-hole (with [] representing the hole):

 

(+ 1 [])

 

In other words, this continuation is a program that will add 1 to whatever is used to fill its hole.

上面这段英文是说,从call/cc开始的剩下的代码,也就是(+ 1 []),"[]"就代表了一个位置,而continuation k就代表了(+ 1 []),其实k就是也个保存了加1运算的全局变量,只要你以后绑定k的值,比如(k 100),那么就会把100放在[]处,然后继续加1运算

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值