You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
builtin set type like python set
can emulate it with map[T]V but having a separate set would be useful and will not waste resources
Use Case
sets have many use cases ....
you can almost build everything with them @
Proposed Solution
mut a := set[int]{0,1,2}
0 in a // true
3 in a // false
a << 3 // add 3 to a
3 in a // true
for i in a{
println(i)
}
// alternative declarations:
a := {0,1,2} // implied type of set[int]
a := {
0
1
2
} // implied type of set[int]
a := set int{0,1,2}
a := set {
0
1
2
}
Other Information
also when tried to use none as map value i get C error
mut a := map[int]none{}
a[0] = none // error: C:/Users/pomid/AppData/Local/Temp/v_0/mmp.8507532903023194351.tmp.c:12695: error: cannot convert 'extern struct IError' to 'unsigned char'
is this intended ?
Acknowledgements
I may be able to implement this feature request
This feature might incur a breaking change
Version used
V 0.4.2 c947c14
Environment details (OS name and version, etc.)
V full version: V 0.4.2 c947c14
OS: windows, Microsoft Windows 10 Pro v19045 64-bit
Processor: 8 cpus, 64bit, little endian,
Describe the feature
builtin set type like python set
can emulate it with map[T]V but having a separate set would be useful and will not waste resources
Use Case
sets have many use cases ....
you can almost build everything with them @
Proposed Solution
Other Information
also when tried to use none as map value i get C error
mut a := map[int]none{}
a[0] = none // error: C:/Users/pomid/AppData/Local/Temp/v_0/mmp.8507532903023194351.tmp.c:12695: error: cannot convert 'extern struct IError' to 'unsigned char'
is this intended ?
Acknowledgements
Version used
V 0.4.2 c947c14
Environment details (OS name and version, etc.)
V full version: V 0.4.2 c947c14
OS: windows, Microsoft Windows 10 Pro v19045 64-bit
Processor: 8 cpus, 64bit, little endian,
getwd: C:\Users\pomid\Desktop\v
vexe: C:\v\v.exe
vexe mtime: 2023-10-15 10:07:34
vroot: OK, value: C:\v
VMODULES: OK, value: C:\Users\pomid.vmodules
VTMP: OK, value: C:\Users\pomid\AppData\Local\Temp\v_0
Git version: git version 2.41.0.windows.1
Note
You can vote for this issue using the 👍 reaction. More votes increase the issue's priority for developers.
Take into account that only the 👍 reaction counts as a vote.
Only reactions to the issue itself will be counted as votes, not comments.
The text was updated successfully, but these errors were encountered: