I have a question on the set data structure in base Julia. As far as I understand, it is mutable, with O(1) membership, and adding an element is done with push!, which modifies the set.
Is there a “functional” set collection that is immutable and for which “adding” elements proceeds by sharing? Or a simple way to emulate this behavior with the default set structure? At the moment, I am using
(s,x) -> union(s, Set(x))
in order to get a new set with x added without modifying s but it is probably not very efficient.
Well, it’s code is very simple. The tests fail, but it probably just needs some PRs to update from deprecated syntax. Sounds like a very good contribution opportunity for a newcomer.