|
Scala example source code file (t2864.scala)
The Scala t2864.scala source code
import scala.util.continuations._
object Test {
def double[B](n : Int)(k : Int => B) : B = k(n * 2)
def main(args : Array[String]) {
reset {
val result1 = shift(double[Unit](100))
val result2 = shift(double[Unit](result1))
println(result2)
}
}
def foo: Int @cps[Int] = {
val a0 = shift((k:Int=>Int) => k(0))
val x0 = 2
val a1 = shift((k:Int=>Int) => x0)
0
}
/*
def bar: ControlContext[Int,Int,Int] = {
shiftR((k:Int=>Int) => k(0)).flatMap { a0 =>
val x0 = 2
shiftR((k:Int=>Int) => x0).map { a1 =>
0
}}
}
*/
}
Other Scala examples (source code examples)Here is a short list of links related to this Scala t2864.scala source code file: |
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.