Skip to content

Commit

Permalink
feat: add PersistentHashSet.toList (#6501)
Browse files Browse the repository at this point in the history
This PR adds `PersistentHashSet.toList`
  • Loading branch information
leodemoura authored Jan 2, 2025
1 parent c0d67e2 commit f0c5936
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Lean/Data/PersistentHashSet.lean
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,8 @@ variable {_ : BEq α} {_ : Hashable α}

@[inline] def fold {β : Type v} (f : β → α → β) (init : β) (s : PersistentHashSet α) : β :=
Id.run $ s.foldM f init

def toList (s : PersistentHashSet α) : List α :=
s.set.toList.map (·.1)

end PersistentHashSet

0 comments on commit f0c5936

Please sign in to comment.