lean4-htt/tests/lean/run/task_test2.lean
Kim Morrison 16bd7ea455
chore: deprecate List.iota (#6708)
This PR deprecates `List.iota`, which we make no essential use of. `iota
n` can be replaced with `(range' 1 n).reverse`. The verification lemmas
for `range'` already have better coverage than those for `iota`.
Any downstream projects using it (I am not aware of any) are encouraged
to adopt it.
2025-01-21 02:32:35 +00:00

22 lines
492 B
Text

--
def run1 (i : Nat) (n : Nat) (xs : List Nat) : Nat :=
n.repeat (fun r =>
dbg_trace ">> [{i}] {r}";
xs.foldl (fun a b => a + b) r)
0
def tst (n : Nat) : IO UInt32 :=
let ys := (List.replicate n 1);
let ts : List (Task Nat) := (List.range 10).map (fun i => Task.spawn fun _ => run1 (i+1) n ys);
let ns : List Nat := ts.map Task.get;
IO.println (">> " ++ toString ns) *>
pure 0
/--
info: >> [100, 100, 100, 100, 100, 100, 100, 100, 100, 100]
---
info: 0
-/
#guard_msgs in
#eval tst 10