This is a great practical generics example. Thanks for sharing! On Sunday, 3 January 2021 at 16:35:38 UTC-8 aphill...@gmail.com wrote:
> I am an avid user of Go who loves how it makes my life so much easier due > to its amazing simplicity. I am thrilled to find that a great deal of > progress has been made in adding (simple) generic types and functions to > the language, which will make my life even simpler! When I discovered the > go2go tool I immediately created a package that implements a variant of the > set container. Rather than using a map it uses a slice of ranges. This has > some performance advantages for some types of real-world sets. > > Note that it is compatible with Ian Lance Taylor's set package (see > src/cmd/go2go/testdata/go2path/src/sets) with the restriction that it only > works with integral types. Apart from (possibly huge) memory advantages for > some types of sets it also has a few useful characteristics: elements are > returned in order + it is possible to invert a set and create a Universal > set (inverse of an empty set). > > The complete source code can be found at > https://github.com/AndrewWPhillips/rangeset. (I wrote it in August but > have updated it to the latest syntax.) I also wrote about it in my blog > <https://devmethodologies.blogspot.com/>last November. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/b0e8b49a-98b1-495f-8d14-e660caf8965dn%40googlegroups.com.