Say when to use set vs HashSet
This commit is contained in:
parent
a1216d18b7
commit
fc4cfcb0d6
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue