I use associative arrays regularly in Lua and awk but Nim doesn't really have the same. Is there a roadmap or is it too angular to implement?
I'd like to be able to do something like this (pseudo-code to unique a list of words):
import strutils
var
arr = split("Blue Blue Red Green", " ") # list of words
uniqarr = newSeq[string](0) # array to hold unique words
for i in arr: # unique the list
uniqarr[i] = 1
for j in uniqarr: # echo the list
echo j
(There are other methods in Nim to unique, this is a demo of associative array technique)
Yeah, it barely takes a few modifications to run the code:
import strutils, tables
var
arr = split("Blue Blue Red Green", " ") # list of words
uniqarr = initTable[string, int]() # array to hold unique words
for i in arr: # unique the list
uniqarr[i] = 1
for j in pairs(uniqarr): # echo the list
echo j
Maybe you are thinking in a more complex situation?