在Scala中,两班制重置是如何具体化的?
我从中了解到,在在Scala中,两班制重置是如何具体化的?,scala,exception-handling,continuations,Scala,Exception Handling,Continuations,我从中了解到,在重置中,单个移位是如何具体化的 reset { 1 + shift {k:Int => Int => k(5)} + 1} 重置{1+shift{k:Int=>Int=>k(5)}+1} 具体化为 val reified = {shiftValue:Int => 1 + shiftValue + 1}; reified (5) val具体化={shiftValue:Int=>1+shiftValue+1};具体化(5) 现在我有另一个例子: reset { 1 + shif
重置
中,单个移位
是如何具体化的
reset { 1 + shift {k:Int => Int => k(5)} + 1}
重置{1+shift{k:Int=>Int=>k(5)}+1}
具体化为
val reified = {shiftValue:Int => 1 + shiftValue + 1}; reified (5)
val具体化={shiftValue:Int=>1+shiftValue+1};具体化(5)
现在我有另一个例子:
reset {
1 + shift(k1:Int => Int => k1(5)} + 1;
2 + shift(k2:Int => Int => k2(6)} + 2
}
重置{
1+shift(k1:Int=>Int=>k1(5)}+1;
2+shift(k2:Int=>Int=>k2(6)}+2
}
具体化为:
val reified ={shifyValue1:Int =>
1 + shiftValue + 1;
2 + shift(k2:Int => Int => k2(6)} + 2
}
reified(5)
val具体化={shifyValue1:Int=>
1+移位值+1;
2+shift(k2:Int=>Int=>k2(6)}+2
}
具体化(5)
我如何进一步具体化它以摆脱第二个移位
val reified ={shiftValue1:Int =>
1 + shiftValue + 1;
val reified2 = {shiftValue2: Int => 2 + shiftValue + 2};
reified2(6)
}
reified(5)
基本上相同的转换
(scala没有安装在这里,所以我只在Scheme中测试了这个转换,它的行为应该是相同的,忽略了任何类型系统问题。)