@tcheran \- all you need is to change your main loop to this (NOTE: the i = 0 
is also unneeded):
    
    
    import tables
    let
      files = @["first","second","third"]
      n = files.len
      initSeq = newSeqUninitialized[int](n)
    var table = initTable[string, newSeqUninitialized[int](n)]()
    for i, file in files:
      table.mgetOrPut("key1", initSeq)[i] = 2*i
    echo table #{"key1": @[0, 2, 4]}
    
    
    Run

Other changes:
    

  * nix unneeded `i`; Nim's for loops are smart enough to have a `pairs` that 
works and is defined for `seq[T]` like your `files`
  * `emptyseq` -> `initSeq` since it is `.len` !=0 but all zero elements -- a 
somewhat rare situation


Reply via email to