lean4-htt/tests/lean/optionGetD.lean
Kim Morrison 74ffa1e413
chore: remove the old Lean.Data.HashMap implementation (#7519)
This PR removes `Lean.Data.HashMap` and `HashSet`. These have been
deprecated for 6 months, replaced by `Std.Data.HashMap` and `HashSet`.
2025-03-20 23:49:55 +00:00

12 lines
299 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Std.Data.HashMap
def test (m : Std.HashMap Nat Nat) : IO (Nat × Nat) := do
let start := 1
let mut i := start
let mut count := 0
while i != 0 do
i := m[i]?.getD (panic! "key is not in the map")
count := count + 1
return (i, count)
#eval test (.ofList [(1,3),(3,2),(2,0)])