News for hackers. Stuff that matters.
Re:Impressions of Go by nickpresta on Tuesday July 23, 2013 @01:23PM (#6091474)
You should actually be using a `struct{}` as the value, as it takes no space (opposed to a bool).

http://play.golang.org/p/KK1ymLzd_e

Re:Impressions of Go by dvirsky on Tuesday July 23, 2013 @01:45PM (#6091644)
Cool, I didn't know that. will change my Set implementation :)

BTW You should remember that if you really want a python-like set, map[interface{}]struct{} is not enough - you still have to implement intersection, union, diff yourself. Not that it's rocket science, but I do think this warrants at least a package in the std library, if not a first class type.

Re:Impressions of Go by nickpresta on Tuesday July 23, 2013 @04:58PM (#6092852)
Agreed. There is an awesome project that provides this: https://github.com/deckarep/golang-set