We've got NewSet(vals...T) for creating a set from multiple values.
But today I found myself wanting to add a slice of objects to an existing set... today I have to write a for loop to range over the objects.
What about adding an append(vals... T) method... similar to Python, which allows adding multiple objects.
Alternatively Add(val T) bool could be modified to take multiple args, which would keep the API surface small. But it's a little undefined that it returns a bool... for multiple objects would that return true if all the objects got added to the existing set, or if at least one object got added?
We've got
NewSet(vals...T)
for creating a set from multiple values.But today I found myself wanting to add a slice of objects to an existing set... today I have to write a for loop to range over the objects.
What about adding an
append(vals... T)
method... similar to Python, which allows adding multiple objects.Alternatively
Add(val T) bool
could be modified to take multiple args, which would keep the API surface small. But it's a little undefined that it returns a bool... for multiple objects would that return true if all the objects got added to the existing set, or if at least one object got added?Thoughts?