lean4-htt/src/Std/Data/HashSet/Iterator.lean
Paul Reichert 7632cefa87
feat: hash map iterators (#10761)
This PR provides iterators on hash maps.
2025-10-14 15:10:01 +00:00

40 lines
912 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.

/-
Copyright (c) 2025 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Paul Reichert
-/
module
prelude
public import Std.Data.HashMap.Iterator
public import Std.Data.HashSet.Basic
public import Std.Data.HashSet.Raw
/-!
# Iterators on `HashSet` and `HashSet.Raw`
-/
namespace Std.HashSet.Raw
/--
Returns a finite iterator over the elements of a hash set.
The iterator yields the elements of the set in order and then terminates.
**Termination properties:**
* `Finite` instance: always
* `Productive` instance: always
-/
@[inline]
public def iter {α : Type u} (m : Raw α) :=
(m.inner.inner.iter.map fun e => e.1 : Iter α)
end Std.HashSet.Raw
namespace Std.HashSet
@[inline, inherit_doc Raw.iter]
public def iter {α : Type u} [BEq α] [Hashable α] (m : HashSet α) :=
(m.inner.inner.iter.map fun e => e.1 : Iter α)
end Std.HashSet