That works but it’s weird. I guess if the passed argument is Enumerable the MapSet.new() call iterates over each item in the passed argument to build the set. So in my original command it’s making a MapSet<[1,2]>, turning it into a list, iterating over that list, and putting each item into a MapSet<[1,2]>. I guess that makes sense. I guess I think it’s a little odd that MapSet.new requires that the passed arg be enumerable. Why is that? Would be nice to say MapSet.new(1) → MapSet<[1]>.
@spec new(Enum.t()) :: t
def new(enumerable)
def new(%__MODULE__{} = map_set), do: map_set
def new(enumerable) do
map =
enumerable
|> Enum.to_list()
|> new_from_list([])
%MapSet{map: map}
end


















