Hacker News new | past | comments | ask | show | jobs | submit login

You can use interfaces types as the keys to a map. So you could easily have a map with both 3-tuples and 4-tuples as keys, just by having one struct with 3 elements and one with 4 implement the same interface and using that as the key. Of course, if you want a truly arbitrary length key, you'll probably have to use the convert-to-string trick.



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

Search: