Skip to content

Commit

Permalink
feat: add HashSet.insertMany
Browse files Browse the repository at this point in the history
  • Loading branch information
semorrison authored and leodemoura committed Nov 28, 2022
1 parent 36cc7c2 commit a3dfa55
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Lean/Data/HashSet.lean
Expand Up @@ -187,3 +187,10 @@ def toArray (m : HashSet α) : Array α :=

def numBuckets (m : HashSet α) : Nat :=
m.val.buckets.val.size

/-- Insert many elements into a HashSet. -/
def insertMany [ForIn Id ρ α] (s : HashSet α) (as : ρ) : HashSet α := Id.run do
let mut s := s
for a in as do
s := s.insert a
return s

0 comments on commit a3dfa55

Please sign in to comment.