lean4-htt/tests/compiler/thunk.lean
Leonardo de Moura 01119b529f test(tests/compiler): add thunk test
This test will take a long time if `thunk` result is not cached.
2019-02-08 11:01:33 -08:00

10 lines
290 B
Text

def compute (v : nat) : thunk nat :=
⟨λ _, let xs := list.repeat v 100000 in xs.foldl (+) 0⟩
@[noinline]
def test (t : thunk nat) (n : nat) : nat :=
n.repeat (λ i r, t.get + r) 0
def main (xs : list string) : io uint32 :=
io.println' (to_string (test (compute 1) 100000)) *>
pure 0