Say when to use set vs HashSet

This commit is contained in:
twetzel59 2017-12-27 21:05:24 -05:00
parent a1216d18b7
commit fc4cfcb0d6
1 changed files with 1 additions and 1 deletions

View File

@ -188,7 +188,7 @@ echo lc[ y*2 | ( y <- x ), int ]
Python sets are not like [Nim set type](http://nim-lang.org/docs/manual.html#types-set-type).
If the values that will go in the set are known beforehand and finite, you can create an Enum for them.
Otherwise you can emulate a Python set using a [HashSet](http://nim-lang.org/docs/sets.html).
The Nim set type is faster and memory-efficient.
The Nim set type is faster and memory-efficient. In fact, set is implemented with a bit vector, whereas HashSet is implemented as a dictionary. For simple flag types and small mathematical sets, use set.
### Dictionaries