I understand from this blog post how a single shift
within a reset
is reified.
reset { 1 + shift {k:Int => Int => k(5)} + 1}
is reified to
val reified = {shiftValue:Int => 1 + shiftValue + 1}; reified (5)
Now I have another example:
reset { 1 + shift(k1:Int => Int => k1(5)} + 1; 2 + shift(k2:Int => Int => k2(6)} + 2 }
It is reified to:
val reified ={shifyValue1:Int => 1 + shiftValue + 1; 2 + shift(k2:Int => Int => k2(6)} + 2 } reified(5)
How can I reify it further to get rid of the 2nd shift
?
val reified ={shiftValue1:Int =>
1 + shiftValue + 1;
val reified2 = {shiftValue2: Int => 2 + shiftValue + 2};
reified2(6)
}
reified(5)
Basically the same transformation.
(scala not installed here, so I only tested this transformation in Scheme, which should behave the same, ignoring any type system issues.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With