How do I create a set type in v? #10092
mark-summerfield
started this conversation in
General
Replies: 2 comments
-
I don't know if it would be "fast" enough for you, but you could just create a string array and use the https://github.com/vlang/v/blob/master/doc/docs.md#in-operator |
Beta Was this translation helpful? Give feedback.
0 replies
-
The set of words will have approx 4000 words in it and a linear search isn't good enough. I want a set or failing that a hash/dict/map. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to create a set type that holds strings. At the moment I'm using
map[string]bool
but I only care about the key and don't need values. Is this possible in v? (I don't want to implement sets from scratch.) What I need is fast membership testing and fast add/remove; ordering doesn't matter.Beta Was this translation helpful? Give feedback.
All reactions