Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> I dislike using booleans instead of empty structs in the same way

Eh? If you have `map[keyType]bool`, then a key lookup is simply the set membership function. If a key exists, it returns true. Otherwise, false. That certainly doesn't seem analogous to abusing integers as booleans...



How do you work out how many elements are in your set?


With the built-in len function.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: