5
Set? (mander.xyz)
submitted 1 year ago by [email protected] to c/[email protected]

Generics have been around for a while now, and although this has been brought up before, do ya'll think a built in set data type like golang-set (or something similar) will come to the stdlib? Do you think it should?

I think it would be a great convenience at little to no cost to the practicalities or philosophies of Go.

you are viewing a single comment's thread
view the rest of the comments
[-] [email protected] 2 points 1 year ago

I find hacking maps to be sets with map[T]bool or map[T]struct{} to be awkward for the most rudimentary use case, membership checking, and downright onerous for anything more "complicated."

I feel as though the datastructure "an unordered collection of things without duplicates, with constant time lookup" is so simple and useful, I don't see any reason to keep it out of the language.

this post was submitted on 20 Jul 2023
5 points (100.0% liked)

Golang

2161 readers
3 users here now

This is a community dedicated to the go programming language.

Useful Links:

Rules:

founded 1 year ago
MODERATORS