Good morning, while working through advent of code this year in Erlang, sets come up A LOT. I was experimenting with erlang-language-platform and it kept yelling at me about constructing sets using the {version, 2}
option. According to sets — stdlib v6.2 a new internal representation was available (“version 2”) in OTP 24 and is more performant.
I like performance! I am also lazy and forgetful . So, I just made a light wrapper around it called s2. The documentation can be found at s2 — s2 v1.0.0. The code can be found at GitHub - chiroptical/s2: A facade over sets. The API surface is more like Haskell’s
Data.Set
library because I am more familiar it. I also added some functionality like cartesian_product/2
and is_proper_subset/2
. Finally, the string representation is much more readable which was useful for advent of code but probably not a deal breaker.
Even if the “version 2” internal representation is made the default across the board in OTP, my library offers a slightly different API surface which you may, or may not, like better. Do you feel like anything is missing? Feel free to send me an issue or PR!
Cheers,
Barry (aka chiroptical)