Comment detail

実行時間の測定 (Nested Flatten)

可変パラメータでも動くようにするには、どうしたらいいのでしょう?? 誰かご存知ですか?

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
def func = { x, y ->
    (x..y).each{
        Thread.sleep(50 + (int)(50*Math.random()))
    }
}

def profile = { function, x, y ->
    def start = java.util.Calendar.instance.timeInMillis
    function(x, y)
    println(java.util.Calendar.instance.timeInMillis - start)
}


def newFunc = profile.curry(func)
newFunc( 200, 250 )

Index

Feed

Other

Link

Pathtraq

loading...